summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-03-14 20:40:07 +0000
committerKarl Berry <karl@freefriends.org>2020-03-14 20:40:07 +0000
commit792d78e8b4555f20ed39adee7f374c4131c1c7aa (patch)
tree57446375e0c4ce7c73876cd47500b32e9753a21f /Master/texmf-dist/tex/luatex
parent8f355f2ef89606139b19478647af702523f7d9e7 (diff)
optex (14mar20)
git-svn-id: svn://tug.org/texlive/trunk@54294 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r--Master/texmf-dist/tex/luatex/optex/basics-macros.opm80
-rw-r--r--Master/texmf-dist/tex/luatex/optex/bib-iso690.opm995
-rw-r--r--Master/texmf-dist/tex/luatex/optex/bib-simple.opm274
-rw-r--r--Master/texmf-dist/tex/luatex/optex/cite-bib.opm251
-rw-r--r--Master/texmf-dist/tex/luatex/optex/colors.opm361
-rw-r--r--Master/texmf-dist/tex/luatex/optex/csplain-params.opm24
-rw-r--r--Master/texmf-dist/tex/luatex/optex/f-lmfonts.opm2
-rw-r--r--Master/texmf-dist/tex/luatex/optex/fams-ini.opm1
-rw-r--r--Master/texmf-dist/tex/luatex/optex/fnotes.opm157
-rw-r--r--Master/texmf-dist/tex/luatex/optex/fonts-opmac.opm4
-rw-r--r--Master/texmf-dist/tex/luatex/optex/fonts-resize.opm25
-rw-r--r--Master/texmf-dist/tex/luatex/optex/fonts-select.opm12
-rw-r--r--Master/texmf-dist/tex/luatex/optex/graphics.opm49
-rw-r--r--Master/texmf-dist/tex/luatex/optex/hyperlinks.opm134
-rw-r--r--Master/texmf-dist/tex/luatex/optex/hyphen-lan.opm110
-rw-r--r--Master/texmf-dist/tex/luatex/optex/if-macros.opm136
-rw-r--r--Master/texmf-dist/tex/luatex/optex/languages.opm75
-rw-r--r--Master/texmf-dist/tex/luatex/optex/lists.opm79
-rw-r--r--Master/texmf-dist/tex/luatex/optex/logos.opm37
-rw-r--r--Master/texmf-dist/tex/luatex/optex/makeindex.opm431
-rw-r--r--Master/texmf-dist/tex/luatex/optex/maketoc.opm157
-rw-r--r--Master/texmf-dist/tex/luatex/optex/math-macros.opm18
-rw-r--r--Master/texmf-dist/tex/luatex/optex/multicolumns.opm103
-rw-r--r--Master/texmf-dist/tex/luatex/optex/op-macros.opm55
-rw-r--r--Master/texmf-dist/tex/luatex/optex/opmac-rest.opm1081
-rw-r--r--Master/texmf-dist/tex/luatex/optex/optex.ini52
-rw-r--r--Master/texmf-dist/tex/luatex/optex/others.opm73
-rw-r--r--Master/texmf-dist/tex/luatex/optex/outlines.opm16
-rw-r--r--Master/texmf-dist/tex/luatex/optex/output.opm178
-rw-r--r--Master/texmf-dist/tex/luatex/optex/parameters.opm468
-rw-r--r--Master/texmf-dist/tex/luatex/optex/pdfuni-string.opm11
-rw-r--r--Master/texmf-dist/tex/luatex/optex/plain-macros.opm6
-rw-r--r--Master/texmf-dist/tex/luatex/optex/prefixed.opm27
-rw-r--r--Master/texmf-dist/tex/luatex/optex/ref-file.opm120
-rw-r--r--Master/texmf-dist/tex/luatex/optex/references.opm111
-rw-r--r--Master/texmf-dist/tex/luatex/optex/sections.opm355
-rw-r--r--Master/texmf-dist/tex/luatex/optex/styles.opm98
-rw-r--r--Master/texmf-dist/tex/luatex/optex/table.opm201
-rw-r--r--Master/texmf-dist/tex/luatex/optex/unimath-codes.opm4
-rw-r--r--Master/texmf-dist/tex/luatex/optex/usebib.opm434
-rw-r--r--Master/texmf-dist/tex/luatex/optex/verbatim.opm225
41 files changed, 4399 insertions, 2631 deletions
diff --git a/Master/texmf-dist/tex/luatex/optex/basics-macros.opm b/Master/texmf-dist/tex/luatex/optex/basics-macros.opm
index 9f87f27c832..23b6a6a43c7 100644
--- a/Master/texmf-dist/tex/luatex/optex/basics-macros.opm
+++ b/Master/texmf-dist/tex/luatex/optex/basics-macros.opm
@@ -2,25 +2,74 @@
\_codedecl \sdef {Basic macros for OpTeX <2020-02-14>}
-\let\_bgroup={ \let\_egroup=}
+ \_doc ------------------------------
+ `\bgroup`, `\egroup`, `\empty`, `\space`, `\null` and `\wlog` are classical
+ macros from plain \TeX/.
+ \_cod ------------------------------
+\let\_bgroup={ \let\_egroup=}
\_def \_empty {}
\_def \_space { }
\_def \_null {\_hbox{}}
\_def \_wlog {\_immediate\_write-1 } % write on log file (only)
+ \_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.
+ \_cod ------------------------------
+
\_edef\_bslash {\_csstring\\}
\_edef \_nbb {\_bslash\_bslash}
\_edef \_pcent{\_csstring\%}
+ \_doc ------------------------------
+ `\sdef{<text>}` is equivalent to `\def\<text>`, where `\<text>` is a control
+ sequence. You can use arbitrary parameter mask after `\sdef{<text>}`, don't
+ put the (unwanted) space immediately after closing brace \code{\}}.
+
+ `\sxdef{<text>}` is equivalent to `\xdef\<text>`.
+
+ `\slet{<textA>}{<textB>}` is equivalent to `\let \<textA> = \<textB>`.
+ \_cod ------------------------------
+
\_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}
-\_def \_adef #1{\_catcode`#1=13 \_begingroup \_lccode`\~=`#1\_lowercase{\_endgroup\_def~}}
+
+ \_doc ------------------------------
+ `\adef{<char>}{<body>}` puts the <char> as active character and defines it
+ as {<body>}. You can use parameter mask too, for example
+ `\adef @#1{...$1...}`
+ \_cod ------------------------------
+
+\_def \_adef #1{\_catcode`#1=13 \_begingroup
+ \_lccode`\~=`#1\_lowercase{\_endgroup\_def~}}
+
+ \_doc ------------------------------
+ `\cs{<text>}` is only a shortcut to `\csname <text>\endcsname`, but you need
+ one more `\ea` if you need to get the real control sequence `\<text>`.
+ \_cod ------------------------------
+
\_def \_cs #1{\_csname#1\_endcsname}
+
+ \_doc ------------------------------
+ `\addto\macro{<text>}` adds <text> to your `\macro`, which must be defined.
+ \_cod ------------------------------
+
\_long\_def \_addto #1#2{\_ea\_def\_ea#1\_ea{#1#2}}
+
+ \_doc ------------------------------
+ `\opwarning{<text>}` prints warning on the terminal and to the log file.
+ \_cod ------------------------------
+
\_def \_opwarning #1{\_wterm{WARNING: #1.}}
+ \_doc ------------------------------
+ `\loggingall` and `\tracingall` is similar as in plain \TeX/, but prints
+ more logging information to the log file and to the terminal.
+ \_cod ------------------------------
+
\_def\_loggingall{\_tracingcommands=3 \_tracingstats=2 \_tracingpages=1
\_tracingoutput=1 \_tracinglostchars=1 \_tracingmacros=2
\_tracingparagraphs=1 \_tracingrestores=1 \_tracingscantokens=1
@@ -36,31 +85,4 @@
\_endcode % -------------------------------------
-`\bgroup`, `\egroup`, `\empty`, `\space`, `\null` and `\wlog` are classical
-macros from plain \TeX/.
-
-`\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.
-
-`\sdef{<text>}` is equivalent to `\def\<text>`, where `\<text>` is a control
-sequence. You can use arbitrary parameter mask after `\sdef{<text>}`, don't
-put the (unwanted) space immediately after closing brace \code{\}}.
-
-`\sxdef{<text>}` is equivalent to `\xdef\<text>`.
-
-`\slet{<textA>}{<textB>}` is equivalent to `\let \<textA> = \<textB>`.
-
-`\adef{<char>}{<body>}` puts the <char> as active character and defines it
-as {<body>}. You can use parameter mask too.
-
-`\cs{<text>}` is only a shortcut to `\csname <text>\endcsname`, but you need
-one more `\ea` if you need to ger the real control sequence `\<text>`.
-
-`\addto\macro{<text>}` adds <text> to your `\macro`, which must be defined.
-
-`\opwarning{<text>}` prints warning on the terminal and to the log file.
-
-`\loggingall` and `\tracingall` is similar as in plain \TeX/, but prints
-more logging information to the log file and to the terminal.
diff --git a/Master/texmf-dist/tex/luatex/optex/bib-iso690.opm b/Master/texmf-dist/tex/luatex/optex/bib-iso690.opm
index a104e589214..8f341330c6e 100644
--- a/Master/texmf-dist/tex/luatex/optex/bib-iso690.opm
+++ b/Master/texmf-dist/tex/luatex/optex/bib-iso690.opm
@@ -1,333 +1,325 @@
-% opmac-bib-iso690 ... the OPmac bib style for reading .bib databases
-% Petr Olsak, Apr. 2015 (beta)
-%
-% The bibliography printing from .bib files by ISO 690 standard is defied here.
-% See the end of this file and the file opmac-bib.tex for more information.
+% This is part of OpTeX project, see http://petr.olsak.net/optex
-\ifx\opmacbibstyle\undefined \errmessage
- {This file can be read by ``\string\usebib/? (simple) bibfiles'' command only}
- \endinput \fi
+% bibliography style (iso690), version <2020-03-10>
+
+\_ifx\_optexbibstyle\_undefined \_errmessage
+ {This file can be read by: \_string\usebib/? (iso690) bibfiles command only}
+ \_endinput \_fi
% misc:
-\def\maybedot{\ifnum\spacefactor=\sfcode`\.\relax\else.\fi}
-\tmpnum=\sfcode`\. \advance\tmpnum by-2 \sfcode`\.=\tmpnum \sfcode`\?=\tmpnum \sfcode`\!=\tmpnum
-\let\.=\maybedot % prevents from double periods
-
-\CreateField {option}
-\def\isbiboption#1#2{\edef\tmp{\noexpand\isbiboptionA{#1}}\tmp}
-\def\isbiboptionA#1{\def\tmp##1 #1 ##2\relax{%
- \if^##2^\csname iffalse\expandafter\endcsname \else\csname iftrue\expandafter\endcsname \fi}%
- \expandafter\tmp\biboptionsi #1 \relax}
-\def\bibopt[#1]#2#3{\isbiboption{#1}\iftrue\def\tmp{#2}\else\def\tmp{#3}\fi\tmp}
-\def\biboptionvalue#1#2{\def\tmp##1 #1:##2 ##3\relax{\def#2{##2}}%
- \expandafter\tmp\biboptionsi #1: \relax}
-
-\def\readbiboptions{%
- \RetrieveFieldIn{option}\biboptionsi
- \toks1=\expandafter{\biboptionsi}%
- \ifx\biboptions\undefined \toks2={}\else \toks2=\expandafter{\biboptions}\fi
- \edef\biboptionsi{\space \the\toks1 \space \the\toks2 \space}%
+\_def\_maybedot{\_ifnum\_spacefactor=\_sfcode`\.\_relax\_else.\_fi}
+\_tmpnum=\_sfcode`\. \_advance\_tmpnum by-2 \_sfcode`\.=\_tmpnum
+\_sfcode`\?=\_tmpnum \_sfcode`\!=\_tmpnum
+\_let\.=\_maybedot % prevents from double periods
+
+\_CreateField {option}
+\_def\_isbiboption#1#2{\_edef\_tmp{\_noexpand\_isbiboptionA{#1}}\_tmp}
+\_def\_isbiboptionA#1{\_def\_tmp##1 #1 ##2\_relax{%
+ \_if^##2^\_csname iffalse\_ea\_endcsname \_else\_csname iftrue\_ea\_endcsname \_fi}%
+ \_ea\_tmp\_biboptionsi #1 \_relax}
+\_def\_bibopt[#1]#2#3{\_isbiboption{#1}\_iftrue\_def\_tmp{#2}\_else\_def\_tmp{#3}\_fi\_tmp}
+\_def\_biboptionvalue#1#2{\_def\_tmp##1 #1:##2 ##3\_relax{\_def#2{##2}}%
+ \_ea\_tmp\_biboptionsi #1: \_relax}
+
+\_def\_readbiboptions{%
+ \_RetrieveFieldIn{option}\_biboptionsi
+ \_toks1=\_ea{\_biboptionsi}%
+ \_edef\_biboptionsi{\_space \_the\_toks1 \_space \_the\_biboptions \_space}%
}
+\_newtoks\_biboptions
+\_public \biboptions ;
% Formating of Author/Editor lists:
-\def\firstauthorformat{%
- \upper{\Lastname}\bprintc\Firstname{, *}\bprintc\Von{ *}\bprintc\Junior{, *}%
+\_def\_firstauthorformat{%
+ \_upper{\_Lastname}\_bprintc\_Firstname{, *}\_bprintc\_Von{ *}\_bprintc\_Junior{, *}%
}
-\def\otherauthorformat{%
- \bprintc\Firstname{* }\bprintc\Von{* }\upper{\Lastname}\bprintc\Junior{, *}%
+\_def\_otherauthorformat{%
+ \_bprintc\_Firstname{* }\_bprintc\_Von{* }\_upper{\_Lastname}\_bprintc\_Junior{, *}%
}
-\def\commonname{%
- \ifnum\NameCount=1
- \firstauthorformat
- \ifx\dobibmark\undefined \edef\dobibmark{\Lastname}\fi
- \else
- \ifnum0\namecount=\NameCount
- \ifx\maybeetal\empty \bibconjunctionand\else , \fi
- \else , \fi
- \otherauthorformat
- \fi
+\_def\_commonname{%
+ \_ifnum\_NameCount=1
+ \_firstauthorformat
+ \_ifx\_dobibmark\_undefined \_edef\_dobibmark{\_Lastname}\_fi
+ \_else
+ \_ifnum0\_namecount=\_NameCount
+ \_ifx\_maybeetal\_empty \_bibconjunctionand\_else , \_fi
+ \_else , \_fi
+ \_otherauthorformat
+ \_fi
}
-\def\authorname{%
- \ifnum\NameCount>0\namecount\relax\else \commonname \fi
- \ifnum\NameCount=0\namecount\relax \maybeetal \fi
+\_def\_authorname{%
+ \_ifnum\_NameCount>0\_namecount\_relax\_else \_commonname \_fi
+ \_ifnum\_NameCount=0\_namecount\_relax \_maybeetal \_fi
}
-\let\editorname=\authorname
-
-\def\prepareauedoptions#1{%
- \def\mabyetal{}\csname lb@abbreviatefalse\endcsname
- \biboptionvalue{#1max}\authormax
- \biboptionvalue{#1min}\authormin
- \biboptionvalue{#1pre}\authorpre
- \biboptionvalue{#1print}\authorprint
- \isbiboption{#1etal}\iftrue \def\maybeetal{\Mtext{bib.etal}}\fi
- \biboptionvalue{#1trim}\autrim
- \let\namecountraw=\namecount
- \ifx\authormax\empty \else
- \ifnum 0\authormax<0\namecount
- \edef\namecount{\ifx\authormin\empty\authormax\else\authormin\fi}%
- \def\maybeetal{\Mtext{bib.etal}}%
- \fi\fi
- \ifx\autrim\empty \def\autrim{10000}\fi
- \ifnum\autrim=0 \def\autrim{10000}\fi
- \ifnum 0\namecount<\autrim\relax \else \AbbreviateFirstname \fi
+\_let\_editorname=\_authorname
+
+\_def\_prepareauedoptions#1{%
+ \_def\_mabyetal{}\_csname lb@abbreviatefalse\_endcsname
+ \_biboptionvalue{#1max}\_authormax
+ \_biboptionvalue{#1min}\_authormin
+ \_biboptionvalue{#1pre}\_authorpre
+ \_biboptionvalue{#1print}\_authorprint
+ \_isbiboption{#1etal}\_iftrue \_def\_maybeetal{\_Mtext{bib.etal}}\_fi
+ \_biboptionvalue{#1trim}\_autrim
+ \_let\_namecountraw=\_namecount
+ \_ifx\_authormax\_empty \_else
+ \_ifnum 0\_authormax<0\_namecount
+ \_edef\_namecount{\_ifx\_authormin\_empty\_authormax\_else\_authormin\_fi}%
+ \_def\_maybeetal{\_Mtext{bib.etal}}%
+ \_fi\_fi
+ \_ifx\_autrim\_empty \_def\_autrim{10000}\_fi
+ \_ifnum\_autrim=0 \_def\_autrim{10000}\_fi
+ \_ifnum 0\_namecount<\_autrim\_relax \_else \_AbbreviateFirstname \_fi
}
-\def\maybeetal{}
+\_def\_maybeetal{}
-\ifx\upper\undefined
- \ifx\sc\undefined \def\upper{\uppercase\expandafter}\else \def\upper#1{{\sc#1}}\fi
-\fi
+\_ifx\upper\_undefined
+ \_ifx\caps \_undefined \_def\upper{\_uppercase\_ea}\_else
+ \_def\upper#1{{\caps\_rm #1}}\_fi
+\_fi
+\_let\_upper=\upper
% Preparing bib-mark (used when \nonumcitations is set):
-\def\setbibmark{%
- \ifx\dobibmark\undefined \def\dobibmark{}\fi
- \RetrieveFieldIn{bibmark}\tmp
- \ifx\tmp\empty \RetrieveFieldIn{year}\tmp \edef\tmp{\dobibmark, \tmp}\fi
- \bibmark=\expandafter{\tmp}%
+\_def\_setbibmark{%
+ \_ifx\_dobibmark\_undefined \_def\_dobibmark{}\_fi
+ \_RetrieveFieldIn{bibmark}\_tmp
+ \_ifx\_tmp\_empty \_RetrieveFieldIn{year}\_tmp \_edef\_tmp{\_dobibmark, \_tmp}\_fi
+ \_bibmark=\_ea{\_tmp}%
}
% Multilinguals: English Czech Slovak
-\mtdef{bib.and} {, and } { a } {}
-\mtdef{bib.etal} { et al.} { a~kol.} {}
-\mtdef{bib.edition} { ed.} { vyd.} {}
-\mtdef{bib.bachthesis} {Bachelor's Thesis} {Bakalářská práce} {Bakalárska práca}
-\mtdef{bib.masthesis} {Master's Thesis} {Diplomová práce} {Diplomová práca}
-\mtdef{bib.phdthesis} {Ph.D. Thesis} {Disertační práce} {Dizertačná práca}
-\mtdef{bib.available} {Available from } {Dostupné na } {}
-\mtdef{bib.availablealso} {Available also from } {Dostupné též na } {Dotupné tiež na }
-\mtdef{bib.citedate} {cit.~} {vid.~} {}
-\mtdef{bib.volume} {Vol.~} {ročník~} {}
-\mtdef{bib.number} {No.~} {č.~} {}
-\mtdef{bib.prepages} {pp.~} {s.~} {}
-\mtdef{bib.postpages} {~p.} {~s.} {}
-\mtdef{bib.editor} {,~ed.} {,~editor} {}
-\mtdef{bib.editors} {,~eds.} {,~editoři} {,~editori}
-
-
-\def\bibconjunctionand{\Mtext{bib.and}}
-\def\preurl{\Mtext{bib.available}}
-\let\predoi=\preurl
-\def\postedition{\mtext{bib.edition}}
-\def\Inclause{In:~}
-\def\prevolume{\mtext{bib.volume}}
-\def\prenumber{\mtext{bib.number}}
-\def\prepages{\mtext{bib.prepages}}
-\def\posteditor{\ifnum0\namecountraw>1 \Mtext{bib.editors}\else\Mtext{bib.editor}\fi}
-
-
-\chardef\documentlanguage=\language
-\def\Mtext#1{\csname _mt:#1:\csname lan:\the\documentlanguage\endcsname\endcsname}
-
-\CreateField {lang}
-\def\setlang#1{\ifx#1\empty \else
- \expandafter \ifx \csname #1Patt\endcsname \relax
- \opwarning{The language "#1" used in .bib file is unknown}
- \else \language=\csname #1Patt\endcsname
- \fi\fi
+\_mtdef{bib.and} {, and } { a } {}
+\_mtdef{bib.etal} { et al.} { a~kol.} {}
+\_mtdef{bib.edition} { ed.} { vyd.} {}
+\_mtdef{bib.bachthesis} {Bachelor's Thesis} {Bakalářská práce} {Bakalárska práca}
+\_mtdef{bib.masthesis} {Master's Thesis} {Diplomová práce} {Diplomová práca}
+\_mtdef{bib.phdthesis} {Ph.D. Thesis} {Disertační práce} {Dizertačná práca}
+\_mtdef{bib.available} {Available from } {Dostupné na } {}
+\_mtdef{bib.availablealso} {Available also from } {Dostupné též na } {Dotupné tiež na }
+\_mtdef{bib.citedate} {cit.~} {vid.~} {}
+\_mtdef{bib.volume} {Vol.~} {ročník~} {}
+\_mtdef{bib.number} {No.~} {č.~} {}
+\_mtdef{bib.prepages} {pp.~} {s.~} {}
+\_mtdef{bib.postpages} {~p.} {~s.} {}
+\_mtdef{bib.editor} {,~ed.} {,~editor} {}
+\_mtdef{bib.editors} {,~eds.} {,~editoři} {,~editori}
+
+\_def\_bibconjunctionand{\_Mtext{bib.and}}
+\_def\_preurl{\_Mtext{bib.available}}
+\_let\_predoi=\_preurl
+\_def\_postedition{\_mtext{bib.edition}}
+\_def\_Inclause{In:~}
+\_def\_prevolume{\_mtext{bib.volume}}
+\_def\_prenumber{\_mtext{bib.number}}
+\_def\_prepages{\_mtext{bib.prepages}}
+\_def\_posteditor{\_ifnum0\_namecountraw>1 \_Mtext{bib.editors}\_else\_Mtext{bib.editor}\_fi}
+
+\_chardef\_documentlanguage=\_language
+\_def\_Mtext#1{\_csname _mt:#1:\_csname _lan:\_the\_documentlanguage\_endcsname\_endcsname}
+
+\_CreateField {lang}
+\_def\_setlang#1{\_ifx#1\_empty \_else
+ \_ea \_ifx \_csname _#1Patt\_endcsname \_relax
+ \_opwarning{The language "#1" used in .bib file is unknown}
+ \_else \_language=\_csname _#1Patt\_endcsname
+ \_fi\_fi
}
-\ifx\USenglish\undefined \chardef\USenglish=0 \fi
-\let\enPatt=\USenglish \let\usPatt=\USenglish
-\ifx\csPatt \undefined \let\csPatt=\czPatt \else \let\czPatt=\csPatt \fi
% Non-standard fieldnames:
-\CreateField {ednote}
-\CreateField {citedate}
-\CreateField {numbering}
-\CreateField {isbn}
-\CreateField {issn}
-\CreateField {doi}
-\CreateField {url}
-\CreateField {bibmark}
+\_CreateField {ednote}
+\_CreateField {citedate}
+\_CreateField {numbering}
+\_CreateField {isbn}
+\_CreateField {issn}
+\_CreateField {doi}
+\_CreateField {url}
+\_CreateField {bibmark}
% Sorting:
-\SortingOrder{name,year}{lfvj}
-\SpecialSort {key}
+\_SortingOrder{name,year}{lfvj}
+\_SpecialSort {key}
% Misc:
-\def\bibwarninga{\bibwarning}
-\def\bibwarningb{\bibwarning}
+\_def\_bibwarninga{\_bibwarning}
+\_def\_bibwarningb{\_bibwarning}
-\def\docitedate #1/#2/#3/#4\relax{[\Mtext{bib.citedate}%
- \if^#2^#1\else
- \if^#3^#1/#2\else
- \docitedateA{#1}{#2}{#3}%
- \fi\fi ]%
+\_def\_docitedate #1/#2/#3/#4\_relax{[\_Mtext{bib.citedate}%
+ \_if^#2^#1\_else
+ \_if^#3^#1/#2\_else
+ \_docitedateA{#1}{#2}{#3}%
+ \_fi\_fi ]%
}
-\def\docitedateA#1#2#3{%
- \ifx\csPatt\undefined \mathchardef\csPatt=10000 \fi
- \ifx\skPatt\undefined \mathchardef\skPatt=10000 \fi
- \ifnum\documentlanguage=\csPatt \docitedateCS{#1}{#2}{#3}%
- \else \ifnum\documentlanguage=\skPatt \docitedateSK{#1}{#2}{#3}%
- \else \docitedateEN{#1}{#2}{#3}%
- \fi\fi
+\_def\_docitedateA#1#2#3{%
+ \_ifnum\_documentlanguage=\_csPatt \_docitedateCS{#1}{#2}{#3}%
+ \_else \_ifnum\_documentlanguage=\_skPatt \_docitedateSK{#1}{#2}{#3}%
+ \_else \_docitedateEN{#1}{#2}{#3}%
+ \_fi\_fi
}
-\def\docitedateEN#1#2#3{#1-#2-#3}
-\def\docitedateCS#1#2#3{\hbox{\tmpnum=#3 \the\tmpnum. \tmpnum=#2 \the\tmpnum. #1}}
-\let\docitedateSK=\docitedateCS
+\_def\_docitedateEN#1#2#3{#1-#2-#3}
+\_def\_docitedateCS#1#2#3{\_hbox{\_tmpnum=#3 \_the\_tmpnum. \_tmpnum=#2 \_the\_tmpnum. #1}}
+\_let\_docitedateSK=\_docitedateCS
-\def\doyear#1{
- \biboptionvalue{yearprint}\yearprint
- \ifx\yearprint\empty#1\else\def\YEAR{#1}\yearprint\fi
+\_def\_doyear#1{
+ \_biboptionvalue{yearprint}\_yearprint
+ \_ifx\_yearprint\_empty#1\_else\_def\YEAR{#1}\_yearprint\_fi
}
-\def\preparenumbering{%
- \def\VOL{\RetrieveField{volume}}%
- \def\NO{\RetrieveField{number}}%
- \def\PP{\RetrieveField{pages}}%
+\_def\_preparenumbering{%
+ \_def\VOL{\_RetrieveField{volume}}%
+ \_def\NO{\_RetrieveField{number}}%
+ \_def\PP{\_RetrieveField{pages}}%
}
-\def\prepareednote{%
- \def\EDN{\RetrieveField{edition}}%
- \def\ADDR{\RetrieveField{address}}%
- \def\PUBL{\RetrieveField{publisher}}%
- \def\YEAR{\RetrieveField{year}}%
- \def\AU{\bprintb[!author]{\doauthor0{####1}}{}}%
- \def\ED{\bprintb[!editor]{\doeditor0{####1}}{}}%
- \preparenumbering
+\_def\_prepareednote{%
+ \_def\EDN{\_RetrieveField{edition}}%
+ \_def\ADDR{\_RetrieveField{address}}%
+ \_def\PUBL{\_RetrieveField{publisher}}%
+ \_def\YEAR{\_RetrieveField{year}}%
+ \_def\AU{\_bprintb[!author]{\_doauthor0{####1}}{}}%
+ \_def\ED{\_bprintb[!editor]{\_doeditor0{####1}}{}}%
+ \_preparenumbering
}
-\def\doedition#1{%
- \biboptionvalue{editionprint}\editionprint
- \ifx\editionprint\empty#1\postedition\else\def\ED{#1}\editionprint\fi
+\_def\_doedition#1{%
+ \_biboptionvalue{editionprint}\_editionprint
+ \_ifx\_editionprint\_empty#1\_postedition\_else\_def\ED{#1}\_editionprint\_fi
}
-\def\doauthor#1#2{\prepareauedoptions{au}\let\iseditorlist=\undefined
- \if1#1\def\AU{#2}\else\let\authorprint=\empty\fi
- \ifx\authorprint\empty #2\else \authorprint\fi
+\_def\_doauthor#1#2{\_prepareauedoptions{au}\_let\_iseditorlist=\_undefined
+ \_if1#1\_def\AU{#2}\_else\_let\_authorprint=\_empty\_fi
+ \_ifx\_authorprint\_empty #2\_else \_authorprint\_fi
}
-\def\doeditor#1#2{\prepareauedoptions{ed}\let\firstauthorformat=\otherauthorformat
- \if1#1\def\ED{#2}\else\let\authorprint=\empty\fi
- \ifx\authorprint\empty #2\posteditor\else \authorprint\fi
+\_def\_doeditor#1#2{\_prepareauedoptions{ed}\_let\_firstauthorformat=\_otherauthorformat
+ \_if1#1\_def\ED{#2}\_else\_let\_authorprint=\_empty\_fi
+ \_ifx\_authorprint\_empty #2\_posteditor\_else \_authorprint\_fi
}
% Entry types:
-\sdef{print:BEGIN}{%
- \readbiboptions
- \biboptionvalue{titlepost}\titlepost
- \isbiboption{unpublished}\iftrue \let\bibwarninga=\relax \let\bibwarningb=\relax \fi
- \isbiboption{nowarn}\iftrue \let\bibwarning=\relax \fi
- \isbiboption{urlalso}\iftrue \def\preurl{\Mtext{bib.availablealso}}\fi
- \RetrieveFieldIn{lang}\langentry \setlang\langentry
+\_sdef{_print:BEGIN}{%
+ \_readbiboptions
+ \_biboptionvalue{titlepost}\_titlepost
+ \_isbiboption{unpublished}\_iftrue \_let\_bibwarninga=\_relax \_let\_bibwarningb=\_relax \_fi
+ \_isbiboption{nowarn}\_iftrue \_let\_bibwarning=\_relax \_fi
+ \_isbiboption{urlalso}\_iftrue \_def\_preurl{\_Mtext{bib.availablealso}}\_fi
+ \_RetrieveFieldIn{lang}\_langentry \_setlang\_langentry
}
-\sdef{print:END}{%
- \bprinta [note] {*.}{}%
- \setbibmark
+\_sdef{_print:END}{%
+ \_bprinta [note] {*.}{}%
+ \_setbibmark
}
-\def\bookgeneric#1{%
- \bprinta [howpublished] {[*].\ }{}%
- \bprintb [edition] {\doedition{##1}\.\ }{}%
- \bprinta [ednote] {*.\ }{}%
- \bprinta [address] {*\bprintv[publisher]{:}{\bprintv[year]{,}{.}}\ }{\bibwarninga}%
- \bprinta [publisher] {*\bprintv[year]{,}{.}\ }{\bibwarninga}%
- \bprintb [year] {\doyear{##1}\bprintv[citedate]{\bprintv[numbering]{.}{}}{.}\ }{\bibwarning}%
- \bprinta [numbering] {\preparenumbering*\bprintv[citedate]{}{\.}\ }{}%
- \bprinta [citedate] {\docitedate*///\relax.\ }{}%
+\_def\_bookgeneric#1{%
+ \_bprinta [howpublished] {[*].\ }{}%
+ \_bprintb [edition] {\_doedition{##1}\.\ }{}%
+ \_bprinta [ednote] {*.\ }{}%
+ \_bprinta [address] {*\_bprintv[publisher]{:}{\_bprintv[year]{,}{.}}\ }{\_bibwarninga}%
+ \_bprinta [publisher] {*\_bprintv[year]{,}{.}\ }{\_bibwarninga}%
+ \_bprintb [year] {\_doyear{##1}\_bprintv[citedate]{\_bprintv[numbering]{.}{}}{.}\ }{\_bibwarning}%
+ \_bprinta [numbering] {\_preparenumbering*\_bprintv[citedate]{}{\.}\ }{}%
+ \_bprinta [citedate] {\_docitedate*///\_relax.\ }{}%
#1%
- \bprinta [series] {*.\ }{}%
- \bprinta [isbn] {ISBN~*.\ }{\bibwarningb}%
- \bprinta [issn] {ISSN~*.\ }{}%
- \bprintb [doi] {\predoi DOI \ulink[http://dx.doi.org/##1]{##1}.\ }{}%
- \bprintb [url] {\preurl\url{##1}. }{}%
+ \_bprinta [series] {*.\ }{}%
+ \_bprinta [isbn] {ISBN~*.\ }{\_bibwarningb}%
+ \_bprinta [issn] {ISSN~*.\ }{}%
+ \_bprintb [doi] {\_predoi DOI \_ulink[http://dx.doi.org/##1]{##1}.\ }{}%
+ \_bprintb [url] {\_preurl\_url{##1}. }{}%
}
-\sdef{print:book}{%
- \bprintb [!author] {\doauthor1{##1}\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1}\bprintc\titlepost{\.\ *}\bprintv[howpublished]{}{\.}\ }{\bibwarning}%
- \bookgeneric{}%
+\_sdef{_print:book}{%
+ \_bprintb [!author] {\_doauthor1{##1}\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\_bprintc\_titlepost{\.\ *}\_bprintv[howpublished]{}{\.}\ }{\_bibwarning}%
+ \_bookgeneric{}%
}
-\sdef{print:article}{%
- \biboptionvalue{journalpost}\journalpost
- \bprintb [!author] {\doauthor1{##1}\.\ }{\bibwarning}%
- \bprinta [title] {*.\ \bprintc\titlepost{*.\ }}{\bibwarning}%
- \bprintb [journal] {{\em##1}\bprintc\journalpost{\.\ *}\bprintv[howpublished]{}{\.}\ }{\bibwarninga}%
- \bprinta [howpublished] {[*].\ }{}%
- \bprinta [address] {*\bprintb[publisher]{:}{,}\ }{}%
- \bprinta [publisher] {*, }{}%
- \bprinta [month] {*, }{}%
- \bprintb [year] {\doyear{##1}\bprintv[volume,number,pages]{,}{\.}\ }{}%
- \bprinta [numbering] {\preparenumbering*\bprintv[citedate]{}{\.}\ }
- {\bprinta [volume] {\prevolume*\bprintv[number,pages]{,}{\.}\ }{}%
- \bprinta [number] {\prenumber*\bprintv[pages]{,}{\.}\ }{}%
- \bprintb [pages] {\prepages\hbox{##1}\bprintv[citedate]{}{\.}\ }{\bibwarninga}}%
- \bprinta [citedate] {\docitedate*///\relax.\ }{}%
- \bprinta [issn] {ISSN~*.\ }{}%
- \bprintb [doi] {\predoi DOI \ulink[http://dx.doi.org/##1]{##1}.\ }{}%
- \bprintb [url] {\preurl\url{##1}. }{}%
+\_sdef{_print:article}{%
+ \_biboptionvalue{journalpost}\_journalpost
+ \_bprintb [!author] {\_doauthor1{##1}\.\ }{\_bibwarning}%
+ \_bprinta [title] {*.\ \_bprintc\_titlepost{*.\ }}{\_bibwarning}%
+ \_bprintb [journal] {{\_em##1}\_bprintc\_journalpost{\.\ *}\_bprintv[howpublished]{}{\.}\ }{\_bibwarninga}%
+ \_bprinta [howpublished] {[*].\ }{}%
+ \_bprinta [address] {*\_bprintb[publisher]{:}{,}\ }{}%
+ \_bprinta [publisher] {*, }{}%
+ \_bprinta [month] {*, }{}%
+ \_bprintb [year] {\_doyear{##1}\_bprintv[volume,number,pages]{,}{\.}\ }{}%
+ \_bprinta [numbering] {\_preparenumbering*\_bprintv[citedate]{}{\.}\ }
+ {\_bprinta [volume] {\_prevolume*\_bprintv[number,pages]{,}{\.}\ }{}%
+ \_bprinta [number] {\_prenumber*\_bprintv[pages]{,}{\.}\ }{}%
+ \_bprintb [pages] {\_prepages\_hbox{##1}\_bprintv[citedate]{}{\.}\ }{\_bibwarninga}}%
+ \_bprinta [citedate] {\_docitedate*///\_relax.\ }{}%
+ \_bprinta [issn] {ISSN~*.\ }{}%
+ \_bprintb [doi] {\_predoi DOI \_ulink[http://dx.doi.org/##1]{##1}.\ }{}%
+ \_bprintb [url] {\_preurl\_url{##1}. }{}%
}
-\sdef{print:inbook}{%
- \let\bibwarningb=\relax
- \bprintb [!author] {\doauthor1{##1}\.\ }{\bibwarning}%
- \bprinta [title] {*.\ }{\bibwarning}%
- \Inclause
- \bprintb [!editor] {\doeditor1{##1}\.\ }{}%
- \bprintb [booktitle] {{\em##1}\bprintc\titlepost{\.\ *}\bprintv[howpublished]{}{\.}\ }{\bibwarning}%
- \bookgeneric{\bprintb [pages] {\prepages\hbox{##1}. }{}}%
+\_sdef{_print:inbook}{%
+ \_let\_bibwarningb=\_relax
+ \_bprintb [!author] {\_doauthor1{##1}\.\ }{\_bibwarning}%
+ \_bprinta [title] {*.\ }{\_bibwarning}%
+ \_Inclause
+ \_bprintb [!editor] {\_doeditor1{##1}\.\ }{}%
+ \_bprintb [booktitle] {{\_em##1}\_bprintc\_titlepost{\.\ *}\_bprintv[howpublished]{}{\.}\ }{\_bibwarning}%
+ \_bookgeneric{\_bprintb [pages] {\_prepages\_hbox{##1}. }{}}%
}
-\slet{print:inproceedings}{print:inbook}
-\slet{print:conference}{print:inbook}
-
-\sdef{print:thesis}{%
- \bprintb [!author] {\doauthor1{##1}\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1}\bprintc\titlepost{\.\ *}\bprintv[howpublished]{}{\.}\ }{\bibwarning}%
- \bprinta [howpublished] {[*].\ }{}%
- \bprinta [address] {*\bprintv[school]{:}{\bprintv[year]{,}{.}}\ }{\bibwarning}%
- \bprinta [school] {*\bprintv[year]{,}{.}\ }{\bibwarning}%
- \bprinta [month] {*, }{}%
- \bprintb [year] {\doyear{##1}\bprintv[citedate]{}{.}\ }{\bibwarninga}%
- \bprinta [citedate] {\docitedate*///\relax.\ }{}%
- \bprinta [type] {*\bprintv[ednote]{,}{.}\ }%
- {\ifx\thesistype\undefined\bibwarning\else\thesistype\bprintv[ednote]{,}{.}\ \fi}%
- \bprinta [ednote] {*.\ }{}%
- \bprintb [doi] {\predoi DOI \ulink[http://dx.doi.org/##1]{##1}.\ }{}%
- \bprintb [url] {\preurl\url{##1}. }{}%
+\_slet{_print:inproceedings}{_print:inbook}
+\_slet{_print:conference}{_print:inbook}
+
+\_sdef{_print:thesis}{%
+ \_bprintb [!author] {\_doauthor1{##1}\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\_bprintc\_titlepost{\.\ *}\_bprintv[howpublished]{}{\.}\ }{\_bibwarning}%
+ \_bprinta [howpublished] {[*].\ }{}%
+ \_bprinta [address] {*\_bprintv[school]{:}{\_bprintv[year]{,}{.}}\ }{\_bibwarning}%
+ \_bprinta [school] {*\_bprintv[year]{,}{.}\ }{\_bibwarning}%
+ \_bprinta [month] {*, }{}%
+ \_bprintb [year] {\_doyear{##1}\_bprintv[citedate]{}{.}\ }{\_bibwarninga}%
+ \_bprinta [citedate] {\_docitedate*///\_relax.\ }{}%
+ \_bprinta [type] {*\_bprintv[ednote]{,}{.}\ }%
+ {\_ifx\_thesistype\_undefined\_bibwarning\_else\_thesistype\_bprintv[ednote]{,}{.}\ \_fi}%
+ \_bprinta [ednote] {*.\ }{}%
+ \_bprintb [doi] {\_predoi DOI \_ulink[http://dx.doi.org/##1]{##1}.\ }{}%
+ \_bprintb [url] {\_preurl\_url{##1}. }{}%
}
-\sdef{print:phdthesis}{\def\thesistype{\Mtext{bib.phdthesis}}\csname print:thesis\endcsname}
-\sdef{print:mastershesis}{\def\thesistype{\Mtext{bib.masthesis}}\csname print:thesis\endcsname}
-\sdef{print:bachelorsthesis}{\def\thesistype{\Mtext{bib.bachthesis}}\csname print:thesis\endcsname}
-
-\sdef{print:generic}{%
- \bprintb [!author] {\doauthor1{##1}\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1}\bprintc\titlepost{\.\ *}\bprintv[howpublished]{}{\.}\ }{\bibwarning}%
- \bprinta [howpublished] {[*].\ }{}%
- \bprinta [ednote] {\prepareednote*\bprintv[citedate]{}{.}\ }{\bibwarning}%
- \bprinta [year] {}{\bibwarning}%
- \bprinta [citedate] {\docitedate*///\relax.\ }{}%
- \bprintb [doi] {\predoi DOI \ulink[http://dx.doi.org/##1]{##1}.\ }{}%
- \bprintb [url] {\preurl\url{##1}. }{}%
+\_sdef{_print:phdthesis}{\_def\_thesistype{\_Mtext{bib.phdthesis}}\_cs{_print:thesis}}
+\_sdef{_print:mastershesis}{\_def\_thesistype{\_Mtext{bib.masthesis}}\_cs{_print:thesis}}
+\_sdef{_print:bachelorsthesis}{\_def\_thesistype{\_Mtext{bib.bachthesis}}\_cs{_print:thesis}}
+
+\_sdef{_print:generic}{%
+ \_bprintb [!author] {\_doauthor1{##1}\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\_bprintc\_titlepost{\.\ *}\_bprintv[howpublished]{}{\.}\ }{\_bibwarning}%
+ \_bprinta [howpublished] {[*].\ }{}%
+ \_bprinta [ednote] {\_prepareednote*\_bprintv[citedate]{}{.}\ }{\_bibwarning}%
+ \_bprinta [year] {}{\_bibwarning}%
+ \_bprinta [citedate] {\_docitedate*///\_relax.\ }{}%
+ \_bprintb [doi] {\_predoi DOI \_ulink[http://dx.doi.org/##1]{##1}.\ }{}%
+ \_bprintb [url] {\_preurl\_url{##1}. }{}%
}
-\slet{print:booklet}{print:generic}
-\slet{print:incolleciton}{print:generic}
-\slet{print:manual}{print:generic}
-\slet{print:proceedings}{print:generic}
-\slet{print:techreport}{print:generic}
-\slet{print:unpublished}{print:generic}
-
-\sdef{print:misc}{\let\bibwarning=\relax \csname print:generic\endcsname}
+\_slet{_print:booklet}{_print:generic}
+\_slet{_print:incolleciton}{_print:generic}
+\_slet{_print:manual}{_print:generic}
+\_slet{_print:proceedings}{_print:generic}
+\_slet{_print:techreport}{_print:generic}
+\_slet{_print:unpublished}{_print:generic}
-\endinput
+\_sdef{_print:misc}{\_let\_bibwarning=\_relax \_cs{_print:generic}}
+\_endcode
-opmac-bib-iso690.tex
-====================
-This is the iso690 bibliographic style used by opmac-bib.tex package.
+This is the iso690 bibliographic style used by \OpTeX/.
-See op-example.bib for an example of the .bib input. You can try it by:
+See `op-example.bib` for an example of the `.bib` input. You can try it by:
-\input opmac-bib
+\begtt
+\fontfam[LMfonts]
\nocite[*]
\usebib/s (iso690) op-example
\end
+\endtt
+\secc Common rules in .bib files
-Common rules in .bib files:
---------------------------
-
-There are entries of type @FOO{...} in the .bib file. Each entry consists of
-fields in the form name = "value", or name = {value}. No matter which form is
-used. If the value is pure numeric then you can say simply name = value.
+There are entries of type `@FOO{...}` in the `.bib` file. Each entry consists of
+fields in the form `name = "value"`, or `name = {value}`. No matter which form is
+used. If the value is pure numeric then you can say simply `name = value`.
Warning: the comma after each field value is mandatory! If it is missing then the
next field is ignored or bad interpreted.
@@ -335,36 +327,40 @@ The entry names and field names are case insensitive. If there exist a data
field no mentioned here then it is simply ignored. You can use it to store
more information (abstract, for example).
-There are ``standard fields'' used in ancient bibTeX (author, title, editor, edition,
-etc., see http://en.wikipedia.org/wiki/BibTeX). The iso690 style introduces
-several ``non-standard'' fields: ednote, numbering, isbn, issn, doi, url,
+There are \"standard fields" used in ancient bib\TeX/ (author, title, editor, edition,
+etc., see \url{http://en.wikipedia.org/wiki/BibTeX}). The `iso690` style introduces
+several \"non-standard" fields: ednote, numbering, isbn, issn, doi, url,
citedate, key, bibmark. They are documented here.
Moreover, there are two optional special fields:
-lang = language of the entry. The hyphenation plus autogenerated phrases and
- abbreviations will be typeset by this language.
-option = options by which you can control special printing of vairous fields.
+\begitems
+* lang = language of the entry. The hyphenation plus autogenerated phrases and
+ abbreviations will be typeset by this language.
+* option = options by which you can control special printing of vairous fields.
+\enditems
There can be only one option field per each entry with (may be) more options
separated by spaces. You can declare the global option(s) in your document
-applied for each entry by \def\biboptions{...}.
+applied for each entry by `\biboptions={...}`.
-The author field
-----------------
+\secc The author field
-All names in the author list have to be separated by " and ". Each author
-can be written by various formats (the ``von'' part is typically missing):
+All names in the author list have to be separated by \"` and `". Each author
+can be written by various formats (the `von` part is typically missing):
+\begtt
Firstname(s) von Lastname
or
von Lastname, Firstname(s)
or
von Lastname, After, Firstname(s)
+\endtt
Only the Lastname part is mandatory. Examples:
+\begtt
Petr Olšák
or
Olšák, Petr
@@ -374,80 +370,96 @@ Only the Lastname part is mandatory. Examples:
da Vinci, Leonardo Piero
or
da Vinci, painter, Leonardo Piero
+\endtt
-The separator " and " between authors will be converted to comma during
-printing, but between semifinal and final author the word "and" (or something
+The separator \"` and `" between authors will be converted to comma during
+printing, but between semifinal and final author the word \"and" (or something
different depending on current language) is printed.
-The first author is printed in reverse order: ``LASTNAME, Firstname(s) von,
-After'' and the others author are printed in normal order: ``Firstname(s)
-von LASTNAME, After''. This feature follows the ISO 690 norm. The Lastname
-is capitalised using uppercase letters, but if the \sc command is defined,
-then it is used as an font switcher in the form {\sc Lastname}. You can
-declare the ``Caps and small caps'' font here.
+The first author is printed in reverse order: \"LASTNAME, Firstname(s) von,
+After" and the others author are printed in normal order: \"Firstname(s)
+von LASTNAME, After". This feature follows the ISO 690 norm. The Lastname
+is capitalised using uppercase letters, but if the \caps font modifier is defined,
+then it is used and printed `{\caps\_rm Lastname}`.
-You can specify the option "aumax:<number>". The <number> denotes the
+You can specify the option `aumax:<number>`. The <number> denotes the
maximum authors to be printed. The rest of authors are ignored and the
-"et~al." is appended to the list of printed authors. This text is
-printed only if the "aumax" value is less than the real number of authors.
+`et~al.` is appended to the list of printed authors. This text is
+printed only if the `aumax` value is less than the real number of authors.
If you have the same number of authors in the .bib file as you need to print
-but you want to append "et~al." then you can use "auetal" option.
+but you want to append `et~al.` then you can use `auetal` option.
-There is a "aumin:<number>" option which denotes the definitive number of
-printed authors if the author list is not fully printed due to "aumax".
-If "aumin" is unused then "aumax" authors is printed in such case.
+There is an `aumin:<number>` option which denotes the definitive number of
+printed authors if the author list is not fully printed due to `aumax`.
+If `aumin` is unused then `aumax` authors is printed in such case.
-All authors are printed if "aumax:<number>" option isn't given.
+All authors are printed if `aumax:<number>` option isn't given.
There is no internal limit. But you can set the global options in
-your document by setting the \biboptions macro. For example:
+your document by setting the `\biboptions` tokens list. For example:
- \def\biboptions {aumax:7 aumin:1}
+\begtt
+ \biboptions={aumax:7 aumin:1}
% if there is 8 or more authors then only first author is printed.
+\entdd
Examples:
+\begtt
author = "John Green and Bob Brown and Alice Black",
+\endtt
output: GREEN, John, Bob BROWN, and Alice BLACK.
+\begtt
author = "John Green and Bob Brown and Alice Black",
option = "aumax:1",
+\endtt
output: GREEN, John~et~al.
+\begtt
author = "John Green and Bob Brown and Alice Black",
option = "aumax:2",
+\endtt
output: GREEN, John, Bob BROWN~et~al.
+\begtt
author = "John Green and Bob Brown and Alice Black",
option = "aumax:3",
+\endtt
output: GREEN, John, Bob BROWN, and Alice BLACK.
+\begtt
author = "John Green and Bob Brown and Alice Black",
option = "auetal",
-
+\endtt
+
output: GREEN, John, Bob BROWN, Alice BLACK~et~al.
If you need to add a text before or after authors list, you can use
-the "auprint:{<value>}" option. The <value> will be printed instead of the
-authors list. The <value> can include \AU macro which expands to the authors
+the `auprint:{<value>}` option. The <value> will be printed instead of the
+authors list. The <value> can include `\AU` macro which expands to the authors
list. Example:
+\begtt
author = "Robert Calbraith",
option = "auprint:{\AU\space [pseudonym of J. K. Rowling]}",
+\endtt
output: CALBRAITH Robert [pseudonym of J. K. Rowling].
-You can use the "autrim:<number>" option. All Firstnames of all authors
+You can use the `autrim:<number>` option. All Firstnames of all authors
are trimmed (i. e. reduced to initials) iff the number of authors in the
author field is greater than or equal to <number>. There is an exception:
-"autrim:0" means that no Firstnames are trimmed. This is default behavior.
-Another example: "autrim:1" means that all Firstnames are trimmed.
+`autrim:0` means that no Firstnames are trimmed. This is default behavior.
+Another example: `autrim:1` means that all Firstnames are trimmed.
+\begtt
author = "John Green and Bob Brown and Alice Black",
option = "auetal autrim:1",
+\endtt
output: GREEN, J., B. BROWN, A. BLACK~et~al.
@@ -455,122 +467,127 @@ If you need to write a team name or institution instead authors, replace all
spaces by \<space> in this name. Such text is interpreted as Lastname. You
can add the secondary name (interpreted as Firstname) after comma. Example:
+\begtt
author = "Czech\ Technical\ University\ in\ Prague, Faculty\ of\ Electrical\ Engeneering",
+\endtt
output: CZECH TECHNICAL UNIVERSITY IN PRAGUE, Faculty of Electrical Engeneering.
-The editor field
-----------------
+\secc The editor field
The editor field is used for list of the authors of the collection. The
analogous rules as in author field are used here. It means that the
-authors are separated by " and ", the Firstnames, Lastnames etc. are
-interpreted and you can use the options "edmax:<number>", "edmin:<number>",
-"edetal", "edtrim:<number>" and "edprint:<value>" (with \ED macro).
+authors are separated by \"` and `", the Firstnames, Lastnames etc. are
+interpreted and you can use the options `edmax:<number>`, `edmin:<number>`,
+`edetal`, `edtrim:<number>` and `edprint:{<value>}` (with `\ED` macro).
Example:
- editor = "Jan Tomek and Petr Karas",
- option = "edprint:{\ED, editors.} edtrim:1",
+\begtt
+ editor = "Jan Tomek and Petr Karas",
+ option = "edprint:{\ED, editors.} edtrim:1",
+\endtt
Output: J. TOMEK and P. KARAS, editors.
-If edprint option is not set then {\ED, eds.} or {\ED, ed.} is used
+If `edprint` option is not set then `{\ED, eds.}` or `{\ED, ed.}` is used
depending on the entry language and on the singular or plural of
the editor(s).
-The ednote field
-----------------
+\secc The ednote field
-The ednote is used as the secondary authors and more editional info. The
+The ednote field is used as the secondary authors and more editional info. The
value is read as raw data without any interpretation of Lastname, Firstname
etc.
- ednote = "Illustrations by Robert \upper{Agarwal}, edited by Tom \upper{Nowak}",
+\begtt
+ ednote = "Illustrations by Robert \upper{Agarwal}, edited by Tom \upper{Nowak}",
+\endtt
output: Illustrations by Robert AGARWAL, edited by Tom NOWAK.
The \upper command have to be used for Lastnames in ednote field.
-The title field
----------------
+\secc The title field
This is the title of the work. It will be printed (in common entry types) by
italics. The ISO 690 norm declares, that the title plus optional subtitle
are in italics and they are separated by colon. Next, the optional secondary
title have to be printed in upright font. This can be added by
-"titlepost:{<value>}". Example:
+`titlepost:{<value>}`. Example:
+\begtt
title = "The Simple Title of The Work",
or
title = "Main Title: Subtitle",
or
title = "Main Title: Subtitle",
option = "titlepost:{Secondary title}",
+\endtt
The output of the last example:
-
{\it Main Title: Subtitle}. Secondary title.
-The edition field
------------------
+\secc The edition field
This field is used only for second or more edition of cited work. Write
only the number without the word "edition". The shortcut "ed." (or something
else depending on current language) is added automatically. Examples:
+\begtt
edition = "Second",
edition = "2nd",
edition = "2$^{\rm nd}$",
edition = "2.",
+\endtt
Output of the last example: 2. ed.
+\begtt
edition = "2."
lang = "cs",
+\endtt
Output: 2. vyd.
-Note, that the example edition = "Second" may cause problems. If you are
-using language "cs" then the output is bad: Second vyd. So, you need to
-say:
-
- edition = "Second",
- lang = "en",
-
-You can use "ednprint:{<value>}" option. The the <value> is printed
+Note, that the example `edition = "Second"` may cause problems. If you are
+using language "cs" then the output is bad: Second vyd.
+But you can use `editionprint:{<value>}` option. The the <value> is printed
instead of edition field and shortcut. The edition field must be set. Example:
+\begtt
edition = "whatever",
- option = "ednprint:{Second full revised edition}",
+ option = "editionprint:{Second full revised edition}",
+\endtt
Output: Second full revised edition.
-You can use \EDN macro in "ednprint" value. This macro is expanded
+You can use `\EDN` macro in `editionprint` value. This macro is expanded
to the edition value. Example:
+\begtt
edition = "Second",
- option = "ednprint:{\EDN\space full revised edition}",
-
+ option = "editionprint:{\EDN\space full revised edition}",
or
-
edition = "Second full revised edition",
- option = "ednprint:{\EDN}",
+ option = "editionprint:{\EDN}",
+\endtt
-The address, publisher, year fields
------------------------------------
+\secc The address, publisher, year fields
-This is an anachronism from ancient BibTeX (unfortunately no exclusive) that
+This is an anachronism from ancient Bib\TeX/ (unfortunately no exclusive) that
the address field includes only the city of the publisher residence. No more
data are here. The publisher field includes the name of the publisher.
+\begtt
address = "Berlin",
publisher = "Springer Verlag",
year = 2012,
+\endtt
Output: Berlin: Springer Verlag, 2012.
@@ -580,132 +597,142 @@ numeric.
The letter a, b etc. are appended to the year automatically, if two or more
subsequent entries in the bibliography list are not distinct by the first
author and year fields. If you needn't this feature, you can use the
-"noautoletters" option.
+`noautoletters` option.
You can use "yearprint:{<value>}" option. If it is set then the <value>
is used for printing year instead the real field value. The reason: year is
-sort sensitive, may be you need to print something else than sorting key.
+sort sensitive, may be you need to print something else than only sorting key.
Example:
+\begtt
year = 2000,
- option = "yearpint:{\copyright 2000}",
+ option = "yearpint:{© 2000}",
+\endtt
-Output: \copyright 2000, sorted by: 2000.
+Output: © 2000, sorted by: 2000.
+\begtt
year = "2012a",
option = "yearprint:{2012}",
+\endtt
Output: 2012, sorted by: 2012a.
The address, publisher and year are typically mandatory fields. If they are
-missing then the OPmac warning occurs. But you can set "unpublished"
+missing then the warning occurs. But you can set `unpublished`
option. Then this warning is suppressed. There is no difference in the
printed output.
-The url field
--------------
+\secc The url field
-Use it without \url macro, but with http:// prefix. Example:
+Use it without `\url` macro, but with `http://` prefix. Example:
- url = "http://petr.olsak.net/opmac.html",
+\begtt
+ url = "http://petr.olsak.net/opmac.html",
+\endtt
-The ISO 690 norm recommends to add the text ``Available from'' (or
+The ISO 690 norm recommends to add the text \"Available from" (or
something else if different current language is used) before URL.
It means, that the output of previous example is:
Available from \url{http://petr.olsak.net/opmac.html}.
-If the "cs" language is the current one than the output is:
+If the `cs` language is the current one than the output is:
Dostupné z: \url{http://petr.olsak.net/opmac.html}.
-If the "urlalso" option is used, then the added text has the form
-``Available also from'' or ``Dostupné také z:'' (if "cs" language is
+If the `urlalso` option is used, then the added text has the form
+\"Available also from" or \"Dostupné také z:" (if `cs` language is
current).
-The citedate field
-------------------
+\secc The citedate field
This is the citation date. The field must be in the form year/month/day. It
means, that the two slashes must be written here. The output depends on the
current language. Example:
- citedate = "2004/05/21",
+\begtt
+ citedate = "2004/05/21",
+\endtt
-Output when "en" is current: [cit. 2004-05-21].
-Output when "cs" is current: [vid. 21.~5.~2004].
+Output when `en` is current: [cit. 2004-05-21].
+Output when `cs` is current: [vid. 21.~5.~2004].
-The howpublished field
-----------------------
+\secc The howpublished field
This declares the available medium for cited document if it is not in printed
form. Alternatives: online, CD, DVD, etc. Example:
- howpublished = "online",
+\begtt
+ howpublished = "online",
+\endtt
Output: [online].
-The volume, number, pages and numbering fields
-----------------------------------------------
+\secc The volume, number, pages and numbering fields
-The volume is the ``big mark'' of the journal issue and the number is the
-``small mark'' of the journal issue and pages includes the page range of
+The volume is the \"big mark" of the journal issue and the number is the
+\"small mark" of the journal issue and pages includes the page range of
the cited article in the journal. The volume is prefixed by Vol.~,
the number by No.~ and the pages by pp.~. But these prefixes depends on the
language of the entry.
Example:
- volume = 31,
- number = 3,
- pages = "37--42",
+\begtt
+ volume = 31,
+ number = 3,
+ pages = "37--42",
+\endtt
Output: Vol.~31, No.~3, pp.~37--42.
- volume = 31,
- number = 3,
- pages = "37--42",
- lang = "cs",
+\begtt
+ volume = 31,
+ number = 3,
+ pages = "37--42",
+ lang = "cs",
+\endtt
Output: ročník~31, č.~3, s.~37--42.
If you disagree with the default prefixes, you can use the numbering field.
-When it is set then it is is used instead of volume, number, pages fields
-and instead of any mentioned prefixes. The numbering can include macros \VOL,
-\NO, \PP, which are expanded to the respective values of fields. Example:
+When it is set then it is used instead of volume, number, pages fields
+and instead of any mentioned prefixes. The numbering can include macros
+`\VOL`, `\NO`, `\PP`, which are expanded to the respective values of fields. Example:
- volume = 31,
- number = 3,
- pages = "37--42"
- numbering = "Issue~\VOL/\NO, pages~\PP",
+\begtt
+ volume = 31,
+ number = 3,
+ pages = "37--42"
+ numbering = "Issue~\VOL/\NO, pages~\PP",
+\endtt
Output: Issue~31/3, pages~37--42
Note: The volume, numbers and pages fields are printed without numbering
-filed only in the @ARTICLE entry. It means, that if you need to visible them
-in the @INBOOK, @INPROCEEDINGS etc. fields, then you must to use numbering field.
+filed only in the `@ARTICLE` entry. It means, that if you need to visible them
+in the `@INBOOK`, `@INPROCEEDINGS` etc. entries, then you must to use numbering field.
-Common notes about entries
---------------------------
+\secc Common notes about entries
The order of the fields in the entry is irrelevant. We use the printed order
in this manual. The exclamation mark (!) denotes the mandatory field. If
such field is missing then the warning occurs during processing.
-If the "unpublished" option is set then the fields address, publisher, year,
-isbn and pages are not mandatory. If the "nowarn" option is set then no
+If the `unpublished` option is set then the fields address, publisher, year,
+isbn and pages are not mandatory. If the `nowarn` option is set then no
warnings about missing mandatory fields occurs.
If the field is used but not mentioned in the entry documentation below then
it is silently ignored.
-The @BOOK entry
----------------
+\p The `@BOOK` entry
This is used for book-like entries.
@@ -715,9 +742,7 @@ publisher(!), year(!), citedate, series, isbn(!), doi, url, note.
The ednote field here means the secondary authors (illustrator, cover design
etc.).
-
-The @ARTICLE entry
-------------------
+\p The `@ARTICLE` entry
This is used for articles published in a journal.
@@ -728,8 +753,7 @@ doi, url, note.
If the numbering is used then it is used instead volume, number, pages.
-The @INBOOK entry
------------------
+\p The `@INBOOK` entry
This is used for the part of a book.
@@ -742,112 +766,105 @@ includes author(s) or editor(s) of whole document. The pages field specifies
the page range of the part. The series field can include more information
about the part (chapter numbers etc.).
-The @INPROCEEDINGS and @CONFERENCE entries are equivalent to @INBOOK entry.
+The `@INPROCEEDINGS` and `@CONFERENCE` entries are equivalent to `@INBOOK` entry.
-
-The @THESIS entry
------------------
+\p The `@THESIS` entry
This is used for student's thesis.
Fields: author(!), title(!), howpublished, address(!), school(!),
month, year(!), citedate, type(!), ednote, doi, url, note.
-The type field must include the text "Master's Thesis" or something
+The type field must include the text \"Master's Thesis" or something
similar (depending on the language of the outer document).
-There are nearly equivalent entries: @BACHELORSTHESIS, @MASTERSTHESIS and
-@PHDTHESIS. These entries sets the type field to an appropriate value
+There are nearly equivalent entries: `@BACHELORSTHESIS`, `@MASTERSTHESIS` and
+`@PHDTHESIS`. These entries set the type field to an appropriate value
automatically. The type field is optional in such case. If it is used then
it has a precedence before default setting.
-
-The @MISC entry
----------------
+\p The @MISC entry
It is intended for various usage.
Fields: author, title, howpublished, ednote, citedate, doi, url, note.
-You can use \AU, \ED, \EDN, \VOL, \NO, \PP, \ADDR, \PUBL, \YEAR
-macros in ednote field. These macros print authors list, editors list,
+You can use `\AU`, `\ED`, `\EDN`, `\VOL`, `\NO`, `\PP`, `\ADDR`, `\PUBL`,
+`\YEAR` macros in ednote field. These macros print authors list, editors list,
edition, volume, number, pages, address, publisher and year field values
-respecitively. If they are are missing then the appropriate macro is empty.
+respecitively.
The reason of this entry is to give to you the possibility to set the format of
entry by your own decision. The most of data are concentrated in ednote
field.
+\p The `@BOOKLET`, `@INCOLLECION`, `@MANUAL`, `@PROCEEDINGS`, `@TECHREPORT`, `@UNPUBLISHED` entries
-The @BOOKLET, @INCOLLECION, @MANUAL, @PROCEEDINGS, @TECHREPORT, @UNPUBLISHED entries
--------------------------------------------------------------------------------------
-
-These entries are equivalent to @MICS entry because we need to save the
+These entries are equivalent to `@MICS` entry because we need to save the
simplicity. They are implemented only for (almost) backward compatibility
-with the ancient BibTeX. But the ednote is mandatory field here, so you
+with the ancient Bib\TeX/. But the ednote is mandatory field here, so you
cannot use these entries from the old databases without warnings and without
-some additional work in the .bib file.
-
+some additional work with the `.bib` file.
-The cite-marks (bibmark) used when \nonumcitations is set
----------------------------------------------------------
+\secc The cite-marks (bibmark) used when \code{\\nonumcitations} is set
-When \nonumcitations is set then \cite prints the cite-marks (called
-bibmark) instead numbers. This style file autogenerates these marks in the
-form "Lastname of the first author, comma, space, the year" if bibmark field
+When `\nonumcitations` is set then `\cite` prints text orientes
+bib-marks instead numbers. This style file autogenerates these marks in the
+form \"Lastname of the first author, comma, space, the year" if bibmark field
isn't declared. If you need to set an exception from this common format,
then you can use bibmark field.
-The OPmac trick http://petr.olsak.net/opmac-tricks-e.html#bibmark
+The OPmac trick \url{http://petr.olsak.net/opmac-tricks-e.html#bibmark}
describes how to redefine the algorithm for bibmark auto-generating when you
need the short form of the type [Au13].
-Sorting
--------
+\secc Sorting
-If \usebib/c is used then entries are sorted by citation order in the text.
-If \usebib/s is used then entries are sorted by ``Lastname, Firstname(s)'' of
+If `\usebib/c` is used then entries are sorted by citation order in the text.
+If `\usebib/s` is used then entries are sorted by \"Lastname, Firstname(s)" of
the first author and if more entries have this value equal, then the year is
used (from older to newer). This feature follows the recommendation of the
ISO 690 norm.
If you have the same authors and the same year, you can control the sorting
by setting years as 2013, 2013a, 2013b, etc. You can print something
-different to the list using "yearprint{<value>}" option, see the section about
+different to the list using `yearprint{<value>}` option, see the section about
address, publisher and year above. The real value of year field (ie. not
-yearprint value) is also used in citations when \nonumcitations is set.
+yearprint value) is also used in the text oriented bib-marks when
+`\nonumcitations` is set.
If you have some problems with name sorting, you can use the hidden field
-"key", which is used for sorting instead of the ``Lastname Firstname(s)''
-of authors. If the "key" field is unset then the ``Lastname Firstname(s)''
+`key`, which is used for sorting instead of the \"Lastname Firstname(s)"
+of authors. If the `key` field is unset then the \"Lastname Firstname(s)"
is used for sorting normally. Example:
- author = "Světla Čmejrková",
- key = "Czzmejrkova Svetla",
+\begtt
+ author = "Světla Čmejrková",
+ key = "Czzmejrkova Svetla",
+\endtt
This entry is now sorted between C and D.
The norm recommends to place the autocitations to the top of the list of
-references. You can do this by setting key = "@", to each entry with your
-name because the "@" character is sorted before A.
+references. You can do this by setting `key = "@"`, to each entry with your
+name because the `@` character is sorted before `A`.
-Languages
----------
+\secc Languages
There is the language of the outer document and the languages of each entry.
The ISO 690 norm recommends that the technical notes (the prefix before URL,
-the media type, the ``and'' conjunction between semifinal and final author)
+the media type, the \"and" conjunction between semifinal and final author)
may be printed in the language of the outer document. The data of the entry
have to be printed in the entry language (edition ed./vyd., Vol./ročník,
No./č. etc.). Finally there are the phrases independent on the language
-(for example In:). Unfortunately, the bibTeX supposes that the entry data
+(for example In:). Unfortunately, the bib\TeX/ supposes that the entry data
are not fully included in value parts of the fields (see edition, volume
etc. fields) so the automaton have to add some text during processing.
But what language have to be chosen?
-The current value of the \language register at the start of the .bib
+The current value of the `\language` register at the start of the `.bib`
processing is decided as the language of the outer document. This language
is used for technical notes regardless of the entry language. Each entry can
have the lang field with the two-letter mark of the entry language. This
@@ -855,68 +872,74 @@ language is used for ed./vyd., vol./ročník etc. and it is used for
hyphenation too. If the entry language is not set then the outer document
language is used.
-If the outer document language is know before creating of the .bib file, you
+If the outer document language is known before creating of the `.bib` file, you
can store some language-dependent phrases into it. On the other hand, if the
main document language is unknown, you can use the \Mtext macro to
create the text multilingual. Example:
- howpublished = "\Mtext{bue-ray}"
+\begtt
+ howpublished = "\Mtext{blue-ray}"
+\endtt
Now, you can set the variants of blue-ray into your macros:
+\begtt
\mtdef {blue-ray} {Blue-ray disc} {Blue-ray disk} {}
-
-
-Tips for using more languages
------------------------------
-
-OPmac prefers English, Czech and Slovak languages. However, you can add
-more languages. If you are using csplain, you can download the
-hyphen-patterns for many languages, see the hyphen.lan file. For example,
-you have had \dePatt and \plPatt downloaded (for German and Polish
-languages). Now, you can do
-
-\sdef{lan:21}{de} \sdef{lan:121}{de}
-\sdef{lan:23}{pl} \sdef{lan:123}{pl}
-\def\mtdefx#1#2#3{\sdef{_mt:#1:de}{#2}\sdef{_mt:#1:pl}{#3}}
-
- % German % Polish
-\mtdefx {bib.and} { und } { a }
-\mtdefx {bib.phdthesis} {Ph.D. Dissertation} {Praca doktorska}
-...
-
-
-Summary of non-standard fields
-------------------------------
-
-This style uses the following fields unkown by bibTeX:
-
-option ... options separated by spaces
-lang ... the language two-letter code of one entry
-ednote ... editional info (secondary authors etc.) or
- global data in @MISC-like entries
-citedate ... the date of the citation in year/month/day format
-numbering ... format for volume, number, pages
-isbn ... ISBN
-issn ... ISSN
-doi ... DOI
-url ... URL
-
-
-Summary of options
-------------------
-
-aumax:<number> ... maximum number of printed authors
-aumin:<number> ... number of printed authors if aumax exceedes
-autrim:<number> ... full Firstnames iff number of authors are less than this
-auprint:{<value>} ... text instead auhors list (\AU macro may be used)
-edmax, edmin, edtrim ... similar as above for editors list
-edprint:{<value>} ... text instead editors list (\ED macro may be used)
-titlepost:{<value>} ... text after title
-yearprint:{<value>} ... text instead real year (\YEAR macro may be used)
-ednprint:{<value>} ... text instead real edition (\EDN macro may be used)
-urlalso ... the ``available also from'' is used instead ``available from''
-unpublished ... the publisher etc. fields are not mandatory
-nowarn ... no mandatory fields
+\endtt
+
+
+\secc Tips for using more languages
+
+This style prefers English, Czech and Slovak languages. However, you can add
+more languages. You can see the avalable languages by expansion of \langlist
+macro. And you can use the shortcuts of language names (`de` and `pl` in the
+example below and you can define all phrases for your language:
+
+\begtt
+ \def\mtdefx#1#2#3{\sdef{_mt:#1:de}{#2}\sdef{_mt:#1:pl}{#3}}
+
+ % German % Polish
+ \mtdefx {bib.and} { und } { a }
+ \mtdefx {bib.phdthesis} {Ph.D. Dissertation} {Praca doktorska}
+ ...
+\endtt
+
+See more about language phrases in the \ref[languages] section.
+
+
+\secc Summary of non-standard fields
+
+This style uses the following fields unkown by bib\TeX/:
+
+\begtt
+ option ... options separated by spaces
+ lang ... the language two-letter code of one entry
+ ednote ... editional info (secondary authors etc.) or
+ global data in @MISC-like entries
+ citedate ... the date of the citation in year/month/day format
+ numbering ... format for volume, number, pages
+ isbn ... ISBN
+ issn ... ISSN
+ doi ... DOI
+ url ... URL
+\endtt
+
+
+\secc Summary of options
+
+\begtt
+ aumax:<number> ... maximum number of printed authors
+ aumin:<number> ... number of printed authors if aumax exceedes
+ autrim:<number> ... full Firstnames iff number of authors are less than this
+ auprint:{<value>} ... text instead auhors list (\AU macro may be used)
+ edmax, edmin, edtrim ... similar as above for editors list
+ edprint:{<value>} ... text instead editors list (\ED macro may be used)
+ titlepost:{<value>} ... text after title
+ yearprint:{<value>} ... text instead real year (\YEAR macro may be used)
+ editionprint:{<value>} . text instead real edition (\EDN macro may be used)
+ urlalso ... the ``available also from'' is used instead ``available from''
+ unpublished ... the publisher etc. fields are not mandatory
+ nowarn ... no mandatory fields
+\endtt
Another options in the option field are silently ignored.
diff --git a/Master/texmf-dist/tex/luatex/optex/bib-simple.opm b/Master/texmf-dist/tex/luatex/optex/bib-simple.opm
index 642c6d84825..46824cb81d7 100644
--- a/Master/texmf-dist/tex/luatex/optex/bib-simple.opm
+++ b/Master/texmf-dist/tex/luatex/optex/bib-simple.opm
@@ -1,183 +1,181 @@
-% opmac-bib-simple ... the OPmac bib style for reading .bib databases
-% Petr Olsak, version Apr. 2015 (beta)
-% See the end of the file opmac-bib.tex for more information.
-% You can compare this file with the old Forth-like BibTeX .bst files.
-% What seems to be more understandable?
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\ifx\opmacbibstyle\undefined \errmessage
- {This file can be read by ``\string\usebib/? (simple) bibfiles'' command only}
- \endinput \fi
+% bibliography style (simple), version <2020-03-10>
+
+\_ifx\_optexbibstyle\_undefined \_errmessage
+ {This file can be read by: \_string\usebib/? (simple) bibfiles command only}
+ \_endinput \_fi
% misc:
-\def\maybedot{\ifnum\spacefactor=\sfcode`\.\relax\else.\fi}
-\tmpnum=\sfcode`\. \advance\tmpnum by-2 \sfcode`\.=\tmpnum
-\sfcode`\?=\tmpnum \sfcode`\!=\tmpnum
-\let\.=\maybedot % prevents from double periods
+\_def\_maybedot{\_ifnum\_spacefactor=\_sfcode`\.\_relax\_else.\_fi}
+\_tmpnum=\_sfcode`\. \_advance\_tmpnum by-2 \_sfcode`\.=\_tmpnum
+\_sfcode`\?=\_tmpnum \_sfcode`\!=\_tmpnum
+\_let\.=\_maybedot % prevents from double periods
% Formating of Author/Editor lists:
-\def\authorname{%
- \ifnum\NameCount>1
- \ifnum0\namecount=\NameCount \mtext{bib.and}\else , \fi
- \else
- \ifx\dobibmark\undefined \edef\dobibmark{\Lastname}\fi
- \fi
- \bprintc\Firstname{* }\bprintc\Von{* }\Lastname\bprintc\Junior{, *}%
+\_def\_authorname{%
+ \_ifnum\_NameCount>1
+ \_ifnum0\_namecount=\_NameCount \_mtext{bib.and}\_else , \_fi
+ \_else
+ \_ifx\_dobibmark\_undefined \_edef\_dobibmark{\_Lastname}\_fi
+ \_fi
+ \_bprintc\_Firstname{* }\_bprintc\_Von{* }\_Lastname\_bprintc\_Junior{, *}%
}
-\let\editorname=\authorname
+\_let\_editorname=\_authorname
% Preparing bib-mark (used when \nonumcitations is set):
-\def\setbibmark{%
- \ifx\dobibmark\undefined \def\dobibmark{}\fi
- \RetrieveFieldIn{bibmark}\tmp
- \ifx\tmp\empty \RetrieveFieldIn{year}\tmp \edef\tmp{\dobibmark, \tmp}\fi
- \bibmark=\expandafter{\tmp}%
+\_def\_setbibmark{%
+ \_ifx\_dobibmark\_undefined \_def\_dobibmark{}\_fi
+ \_RetrieveFieldIn{bibmark}\_tmp
+ \_ifx\_tmp\_empty \_RetrieveFieldIn{year}\_tmp \_edef\_tmp{\_dobibmark, \_tmp}\_fi
+ \_bibmark=\_ea{\_tmp}%
}
% Multilinguals: English Czech Slovak
-\mtdef{bib.and} {, and } { a } {}
-\mtdef{bib.edition} {edition} {vydání} {vydanie}
-\mtdef{bib.masterthesis} {Master's Thesis} {Diplomová práce} {Diplomová práca}
-\mtdef{bib.phdthesis} {Ph.D. Thesis} {Disertační práce} {Dizertačná práca}
+\_mtdef{bib.and} {, and } { a } {}
+\_mtdef{bib.edition} {edition} {vydání} {vydanie}
+\_mtdef{bib.masterthesis} {Master's Thesis} {Diplomová práce} {Diplomová práca}
+\_mtdef{bib.phdthesis} {Ph.D. Thesis} {Disertační práce} {Dizertačná práca}
-\def\preurl{\hfil\break}
+\_def\_preurl{\_hfil\_break}
% Non-standard fieldnames:
-\CreateField {isbn}
-\CreateField {doi}
-\CreateField {url}
-\CreateField {bibmark}
+\_CreateField {isbn}
+\_CreateField {doi}
+\_CreateField {url}
+\_CreateField {bibmark}
% Sorting:
-\SortingOrder{name,year}{lfvj}
-\SpecialSort {key}
+\_SortingOrder{name,year}{lfvj}
+\_SpecialSort {key}
% Entry types:
-\sdef{print:END}{%
- \bprinta [note] {*.}{}%
- \setbibmark
+\_sdef{_print:END}{%
+ \_bprinta [note] {*.}{}%
+ \_setbibmark
}
-\sdef{print:book}{%
- \bprinta [!author] {*\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1}.\ }{\bibwarning}%
- \bprinta [edition] {*~\mtext{bib.edition}.\ }{}%
- \bprinta [address] {*: }{\bibwarning}%
- \bprinta [publisher] {*, }{\bibwarning}%
- \bprinta [year] {*.\ }{\bibwarning}%
- \bprinta [isbn] {ISBN~*.\ }{\bibwarning}%
- \bprintb [url] {\preurl\url{##1}. }{}%
+\_sdef{_print:book}{%
+ \_bprinta [!author] {*\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}.\ }{\_bibwarning}%
+ \_bprinta [edition] {*~\_mtext{bib.edition}.\ }{}%
+ \_bprinta [address] {*: }{\_bibwarning}%
+ \_bprinta [publisher] {*, }{\_bibwarning}%
+ \_bprinta [year] {*.\ }{\_bibwarning}%
+ \_bprinta [isbn] {ISBN~*.\ }{\_bibwarning}%
+ \_bprintb [url] {\_preurl\_url{##1}. }{}%
}
-\sdef{print:article}{%
- \bprinta [!author] {*\.\ }{\bibwarning}%
- \bprinta [title] {*.\ }{\bibwarning}%
- \bprintb [journal] {{\em##1}.\ }{\bibwarning}%
- \bprinta [year] {*, }{}%
- \bprinta [volume] {* }{}%
- \bprinta [number] {(*), }{}%
- \bprinta [pages] {*.\ }{}%
- \bprintb [doi] {DOI~\ulink[http://dx.doi.org/##1]{##1}.\ }{}%
+\_sdef{_print:article}{%
+ \_bprinta [!author] {*\.\ }{\_bibwarning}%
+ \_bprinta [title] {*.\ }{\_bibwarning}%
+ \_bprintb [journal] {{\_em##1}.\ }{\_bibwarning}%
+ \_bprinta [year] {*, }{}%
+ \_bprinta [volume] {* }{}%
+ \_bprinta [number] {(*), }{}%
+ \_bprinta [pages] {*.\ }{}%
+ \_bprintb [doi] {DOI~\_ulink[http://dx.doi.org/##1]{##1}.\ }{}%
}
-\sdef{print:inbook}{%
- \bprinta [!author] {*\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1.}\ }{\bibwarning}%
+\_sdef{_print:inbook}{%
+ \_bprinta [!author] {*\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1.}\ }{\_bibwarning}%
In:~%
- \bprinta [!editor] {*,~eds.\ }{}%
- \bprintb [booktitle] {{\em##1}.\ }{\bibwarning}%
- \bprinta [address] {*: }{\bibwarning}%
- \bprinta [publisher] {*, }{\bibwarning}%
- \bprinta [year] {*.\ }{\bibwarning}%
- \bprinta [chapter] {*.\ }{%
- \bprinta [pages] {*.\ }{}}%
- \bprinta [isbn] {ISBN~*.\ }{\bibwarning}%
- \bprintb [url] {\preurl\url{##1}. }{}%
+ \_bprinta [!editor] {*,~eds.\ }{}%
+ \_bprintb [booktitle] {{\_em##1}.\ }{\_bibwarning}%
+ \_bprinta [address] {*: }{\_bibwarning}%
+ \_bprinta [publisher] {*, }{\_bibwarning}%
+ \_bprinta [year] {*.\ }{\_bibwarning}%
+ \_bprinta [chapter] {*.\ }{%
+ \_bprinta [pages] {*.\ }{}}%
+ \_bprinta [isbn] {ISBN~*.\ }{\_bibwarning}%
+ \_bprintb [url] {\_preurl\_url{##1}. }{}%
}
-\slet{print:inproceedings}{print:inbook}
-
-\sdef{print:incolection}{%
- \bprinta [!author] {*\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1}.\ }{\bibwarning}%
- \bprinta [crossreff] {In~\cite[*]. }{%
- \bprinta [booktitle] {*. }{\bibwarning}%
- \bprinta [!editor] {*,~eds.\ }{\bibwarning}%
- \bprinta [edition] {*~\mtext{bib.edition}.\ }{\bibwarning}%
- \bprinta [address] {*: }{\bibwarning}%
- \bprinta [publisher] {*, }{\bibwarning}%
- \bprinta [year] {*.\ }{\bibwarning}%
- \bprinta [pages] {*.\ }{}%
- \bprintb [url] {\preurl\url{####1}. }{}}%
+\_slet{_print:inproceedings}{_print:inbook}
+
+\_sdef{_print:incolection}{%
+ \_bprinta [!author] {*\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}.\ }{\_bibwarning}%
+ \_bprinta [crossreff] {In~\_cite[*]. }{%
+ \_bprinta [booktitle] {*. }{\_bibwarning}%
+ \_bprinta [!editor] {*,~eds.\ }{\_bibwarning}%
+ \_bprinta [edition] {*~\_mtext{bib.edition}.\ }{\_bibwarning}%
+ \_bprinta [address] {*: }{\_bibwarning}%
+ \_bprinta [publisher] {*, }{\_bibwarning}%
+ \_bprinta [year] {*.\ }{\_bibwarning}%
+ \_bprinta [pages] {*.\ }{}%
+ \_bprintb [url] {\_preurl\_url{####1}. }{}}%
}
-\sdef{print:conference}{%
- \bprinta [!author] {*\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1}\.\ }{\bibwarning}%
- \bprinta [edition] {*~\mtext{bib.edition}.\ }{}%
- \bprinta [address] {*: }{\bibwarning}%
- \bprinta [publisher] {*, }{\bibwarning}%
- \bprinta [year] {*.\ }{\bibwarning}%
- \bprinta [isbn] {ISBN~*.\ }{}%
- \bprintb [url] {\preurl\url{##1}. }{}%
+\_sdef{_print:conference}{%
+ \_bprinta [!author] {*\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\.\ }{\_bibwarning}%
+ \_bprinta [edition] {*~\_mtext{bib.edition}.\ }{}%
+ \_bprinta [address] {*: }{\_bibwarning}%
+ \_bprinta [publisher] {*, }{\_bibwarning}%
+ \_bprinta [year] {*.\ }{\_bibwarning}%
+ \_bprinta [isbn] {ISBN~*.\ }{}%
+ \_bprintb [url] {\_preurl\_url{##1}. }{}%
}
-\sdef{print:phdthesis}{%
- \bprinta [!author] {*\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1}\.\ }{\bibwarning}%
- \mtext{bib.phdthesis}, %
- \bprinta [school] {*.\ }{}%
- \bprinta [address] {*, }{}%
- \bprinta [year] {*.\ }{}%
- \bprintb [url] {\preurl\url{##1}. }{}%
+\_sdef{_print:phdthesis}{%
+ \_bprinta [!author] {*\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\.\ }{\_bibwarning}%
+ \_mtext{bib.phdthesis}, %
+ \_bprinta [school] {*.\ }{}%
+ \_bprinta [address] {*, }{}%
+ \_bprinta [year] {*.\ }{}%
+ \_bprintb [url] {\_preurl\_url{##1}. }{}%
}
-\sdef{print:mastersthesis}{%
- \bprinta [!author] {*\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1}\.\ }{\bibwarning}%
- \mtext{bib.masterthesis}, %
- \bprinta [school] {*.\ }{}%
- \bprinta [address] {*, }{}%
- \bprinta [year] {*.\ }{}%
- \bprintb [url] {\preurl\url{##1}. }{}%
+\_sdef{_print:mastersthesis}{%
+ \_bprinta [!author] {*\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\.\ }{\_bibwarning}%
+ \_mtext{bib.masterthesis}, %
+ \_bprinta [school] {*.\ }{}%
+ \_bprinta [address] {*, }{}%
+ \_bprinta [year] {*.\ }{}%
+ \_bprintb [url] {\_preurl\_url{##1}. }{}%
}
-\sdef{print:proceedings}{%
- \bprinta [!author] {*\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1}\.\ }{\bibwarning}%
- \bprinta [publisher] {*.\ }{%
- \bprinta [organization] {*.\ }{\bibwarning}}%
+\_sdef{_print:proceedings}{%
+ \_bprinta [!author] {*\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\.\ }{\_bibwarning}%
+ \_bprinta [publisher] {*.\ }{%
+ \_bprinta [organization] {*.\ }{\_bibwarning}}%
}
-\sdef{print:techreport}{%
- \bprinta [!author] {*\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1}\.\ }{\bibwarning}%
- \mtext{bib.techreport}.
- \bprinta [institution] {*.\ }{}%
+\_sdef{_print:techreport}{%
+ \_bprinta [!author] {*\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\.\ }{\_bibwarning}%
+ \_mtext{bib.techreport}.
+ \_bprinta [institution] {*.\ }{}%
}
-\sdef{print:booklet}{%
- \bprinta [!author] {*\.\ }{\bibwarning}%
- \bprintb [title] {{\em##1}\.\ }{\bibwarning}%
- \bprinta [howpublished] {*.\ }{\bibwarning}%
+\_sdef{_print:booklet}{%
+ \_bprinta [!author] {*\.\ }{\_bibwarning}%
+ \_bprintb [title] {{\_em##1}\.\ }{\_bibwarning}%
+ \_bprinta [howpublished] {*.\ }{\_bibwarning}%
}
-\sdef{print:manual}{%
- \bprinta [!author] {*\.\ }{}%
- \bprintb [title] {{\em##1}\.\ }{\bibwarning}%
- \bprinta [year] {*.\ }{}%
- \bprinta [institution] {*.\ }{}%
- \bprintb [url] {\preurl\url{##1}. }{}%
+\_sdef{_print:manual}{%
+ \_bprinta [!author] {*\.\ }{}%
+ \_bprintb [title] {{\_em##1}\.\ }{\_bibwarning}%
+ \_bprinta [year] {*.\ }{}%
+ \_bprinta [institution] {*.\ }{}%
+ \_bprintb [url] {\_preurl\_url{##1}. }{}%
}
-\sdef{print:misc}{%
- \bprinta [!author] {*\.\ }{}%
- \bprintb [title] {{\em##1}\.\ }{}%
- \bprinta [howpublished] {*.\ }{}%
- \bprinta [institution] {*.\ }{}%
- \bprinta [series] {*.\ }{}%
- \bprinta [year] {*.\ }{}%
- \bprintb [url] {\preurl\url{##1}. }{}%
+\_sdef{_print:misc}{%
+ \_bprinta [!author] {*\.\ }{}%
+ \_bprintb [title] {{\_em##1}\.\ }{}%
+ \_bprinta [howpublished] {*.\ }{}%
+ \_bprinta [institution] {*.\ }{}%
+ \_bprinta [series] {*.\ }{}%
+ \_bprinta [year] {*.\ }{}%
+ \_bprintb [url] {\_preurl\_url{##1}. }{}%
}
%%% end of the style file
-\endinput
+\_endcode
-You can copy this file to opmac-bib-yourname.tex and modify it by your
+You can copy this file to bib-yourname.opm and modify it by your
needs...
diff --git a/Master/texmf-dist/tex/luatex/optex/cite-bib.opm b/Master/texmf-dist/tex/luatex/optex/cite-bib.opm
new file mode 100644
index 00000000000..505b18bb358
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/cite-bib.opm
@@ -0,0 +1,251 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \cite {Cite, Biblioraphy <2020-03-09>} % loaded in format
+
+ \_doc -----------------------------
+ Registers used by `\cite`, `\bib` macros are declared here
+ \_cod -----------------------------
+
+\_newcount\_bibnum % the bibitem counter
+\_newtoks\_bibmark % the bibmark used if \nonumcitations
+\_newcount\_lastcitenum \_lastcitenum=0 % for \shortcitations
+\_public \bibnum \bibmark ;
+
+ \_doc -----------------------------
+ `\cite [<label>,<label>,...,<label>]` manages <labes> using `\_citeA`
+ and prints prints `[<bib-marks>]` using `\_printsavedcites`.
+ `\nocite [<label>,<label>,...,<label>]` only manages <labels> but prints nothing.
+ `\rcite [<label>,<label>,...,<label>]` behaves like `\cite` but prints
+ <bib-marks> without brackets.
+ `\ecite [<label>]{<text>}` behaves like `\rcite [<label>]` but prints
+ <text> instead <bib-mark>. The <text> is hyperlinked like <bib-marks>
+ when `\cite` or `\rcite` is used.
+ The emptpty internal macro `\_savedcites` will include the <bib-marks> list to
+ be printed. This list is set by `\_citeA` inside group and it is used by
+ `\_printsavedcites` in the same group. Each `\cite`/`\rcite`/`\ecite` macro
+ starts from empty list of <bib-marks> because new group is opened.
+ \_cod -----------------------------
+
+\_def\_cite[#1]{{\_citeA#1,,,[\_printsavedcites]}}
+\_def\_nocite[#1]{{\_citeA#1,,,}}
+\_def\_rcite[#1]{{\_citeA#1,,,\_printsavedcites}}
+\_def\_ecite[#1]{\_bgroup\_citeA#1,,,\_ea\_eciteB\_savedcites;}
+\_def\_eciteB#1,#2;#3{\_if?#1\_relax #3\_else \_ilink[cite:#1]{#3}\_fi\_egroup}
+\_def\_savedcites{}
+
+\_public \cite \nocite \rcite \ecite ;
+
+ \_doc -----------------------------
+ <bib-marks> may be numbers or a special text related to cited bib-entry.
+ It depends on `\nonumcitations` and on used bib-style. The mapping from
+ <label> to <bib-makr> is done when `\bib` or `\usebib` is processed.
+ These macros store the information to
+ `\_Xbib{<label>}{<number>}{<nonumber>}` where <number> and <nonumber> are
+ two variants of <bib-mark> (numbered or text-like). This information is
+ read from `.ref` file and it is saved to macros
+ \_bib:<label> and \_bibm:<number>. First one includes number and second
+ one includes <nonumber>. The `\_lastbibnum` macro includes last number of
+ bib-entry used in the document. A designer can use it to set apropriate
+ indentation when printing the list of all bib-entries.
+ \_cod -----------------------------
+
+\_def\_Xbib#1#2#3{\_sdef{_bib:#1}{\_bibnn{#2}&}%
+ \_if^#3^\_else\_sdef{_bim:#2}{#3}\_fi\_def\_lastbibnum{#2}}
+
+ \_doc -----------------------------
+ `\_citeA <label>,` processes one label from list of labels given in the
+ parameter of `\cite`, `\nocite`, `\rcite` or `\ecite` macros. It adds the
+ <label> to global list `\_citelist` which will be used by `\usebib` (it
+ must to know what <labels> are used in the document in order to pick-up
+ only relevant bib-entries from the database. Because we want to save
+ space and not to save the same <label> to `\_citelist` twice, we
+ distinguish four cases:
+ \begitems
+ * <label> was not declared by `\_Xbib` and it is first such <label> in the
+ document: Then `\_bib:<label>` is undefined and we save label using
+ `\_addcitlist`, write warning on the terminal and define
+ `\_bib:<label>` as empty.
+ * <label> was not declared by `\_Xbib` but it was used previously in the
+ document: Then `\_bib:<label>` is empty and we do nothing (only data to
+ `\_savedcites` are saved).
+ * <label> was declared by `\_Xbib` and it is first such <label> in the
+ document: Then `\_bin:<label>` includes `\_bibnn{<number>}&` and we
+ test this case by `\if &\_bibnn{<number>}&` when `\_bibnn{<number>}`
+ expands to empty. The <label> is saved by `\_addcitelist` and
+ `\_bib:<label>` is re-defined directly as <number>.
+ * <label> was declared by `\_Xbib` and it was used previously in the
+ document. Then we do nothing (only data to `\_savedcites` are saved.
+ \enditems
+ The `\_citeA` macro runs repeatedly over whole list of <labels>.
+ \_cod -----------------------------
+
+\_def\_citeA #1#2,{\_if#1,\_else
+ \_if *#1\_addcitelist{*}\_ea\_skiptorelax \_fi
+ \_ifcsname _bib:#1#2\_endcsname \_else
+ \_addcitelist{#1#2}%
+ \_opwarning{The cite [#1#2] unknown. Try to TeX me again}\_openref
+ \_addto\_savedcites{?,}\_def\_sortcitesA{}\_lastcitenum=0
+ \_ea\_gdef \_csname _bib:#1#2\_endcsname {}%
+ \_ea\_skiptorelax \_fi
+ \_ea\_ifx \_csname _bib:#1#2\_endcsname \_empty
+ \_addto\_savedcites{?,}\_def\_sortcitesA{}\_lastcitenum=0
+ \_ea\_skiptorelax \_fi
+ \_def\_bibnn##1{}%
+ \_if &\_csname _bib:#1#2\_endcsname
+ \_def\_bibnn##1##2{##1}%
+ \_addcitelist{#1#2}%
+ \_sxdef{_bib:#1#2}{\_csname _bib:#1#2\_endcsname}%
+ \_fi
+ \_edef\_savedcites{\_savedcites \_csname _bib:#1#2\_endcsname,}%
+ \_relax
+ \_ea\_citeA\_fi
+}
+\_def\_addcitelist#1{\_global\_addto\_citelist{\_citeI[#1]}}
+\_def\_citelist{}
+
+ \_doc -----------------------------
+ The <bib-marks> (in numeric or text form) are saved in `\_savedcites`
+ macro separated by commas.
+ The `\_printsavedcites` prints them by normal order or sorted if
+ `\sortcitations` is specified or condensed if `\shordcitations` is
+ specified.
+ `\sortcitations` appends the dummy number 300000 and we suppose that normal
+ numbers of bib-entries are less than this constant.
+ This constant is removed after sorting algorithm.
+ The macros for <bib-marks> printing folows (sorry, without detail
+ documentation). They are documented in `opmac-d.pdf` (but only in Czech).
+ \_cod -----------------------------
+
+\_def\_printsavedcites{\_sortcitesA
+ \_chardef\_tmpb=0 \_ea\_citeB\_savedcites,%
+ \_ifnum\_tmpb>0 \_printdashcite{\_the\_tmpb}\_fi
+}
+\_def\_sortcitesA{}
+\_def\_sortcitations{%
+ \_def\_sortcitesA{\_edef\_savedcites{300000,\_ea}\_ea\_sortcitesB\_savedcites,%
+ \_def\_tmpa####1300000,{\_def\_savedcites{####1}}\_ea\_tmpa\_savedcites}%
+}
+\_def\_sortcitesB #1,{\_if $#1$%
+ \_else
+ \_mathchardef\_tmpa=#1
+ \_edef\_savedcites{\_ea}\_ea\_sortcitesC \_savedcites\_end
+ \_ea\_sortcitesB
+ \_fi
+}
+\_def\_sortcitesC#1,{\_ifnum\_tmpa<#1\_edef\_tmpa{\_the\_tmpa,#1}\_ea\_sortcitesD
+ \_else\_edef\_savedcites{\_savedcites#1,}\_ea\_sortcitesC\_fi}
+\_def\_sortcitesD#1\_end{\_edef\_savedcites{\_savedcites\_tmpa,#1}}
+
+\_def\_citeB#1,{\_if$#1$\_else
+ \_if?#1\_relax??%
+ \_else
+ \_ifnum\_lastcitenum=0 % only comma separated list
+ \_printcite{#1}%
+ \_else
+ \_ifx\_citesep\_empty % first cite item
+ \_lastcitenum=#1\_relax
+ \_printcite{#1}%
+ \_else % next cite item
+ \_advance\_lastcitenum by1
+ \_ifnum\_lastcitenum=#1\_relax % cosecutive cite item
+ \_mathchardef\_tmpb=\_lastcitenum
+ \_else % there is a gap between cite items
+ \_lastcitenum=#1\_relax
+ \_ifnum\_tmpb=0 % previous items were printed
+ \_printcite{#1}%
+ \_else
+ \_printdashcite{\_the\_tmpb}\_printcite{#1}\_chardef\_tmpb=0
+ \_fi\_fi\_fi\_fi\_fi
+ \_ea\_citeB\_fi
+}
+\_def\_shortcitations{\_lastcitenum=1 }
+
+\_def\_printcite#1{\_citesep\_ilink[cite:#1]{\_citelinkA{#1}}\_def\_citesep{,\_hskip.2em\_relax}}
+\_def\_printdashcite#1{\_ifmmode-\_else\_hbox{--}\_fi\_ilink[cite:#1]{\_citelinkA{#1}}}
+\_def\_citesep{}
+
+\_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 BibTeX style}\_fi}
+}
+\_def\_citelinkA{}
+
+\_public \nonumcitations \sortcitations \shortcitations ;
+
+ \_doc -----------------------------
+ The `\bib [<label>] {<optional bib-mark>}` prints one bib-entry
+ without reading any database. The bib-enty follows after this command.
+ This command counts the used `\bib`s from one by `\bibnum` counter and
+ saves `\_Xbib{<label>}{\_the\_bibnum}{\_the\_bibmark}` into `.ref` file
+ immediately using `\_wbib`. This is the core of creation of mapping from
+ <labels> to <bib-marks>.
+ \_cod -----------------------------
+
+\_def\_bib[#1]{\_def\_tmp{\_isnextchar={\_bibA[#1]}{\_bibmark={}\_bibB[#1]}}%
+ \_ea\_tmp\_romannumeral-`\.} % ignore optional space
+\_def\_bibA[#1]=#2{\_bibmark={#2}\_bibB[#1]}
+\_def\_bibB[#1]{\_par \_bibskip
+ \_advance\_bibnum by1
+ \_noindent \_def\_tmpb{#1}\_wbib{#1}{\_the\_bibnum}{\_the\_bibmark}%
+ \_printbib \_ignorespaces
+}
+\_def\_wbib#1#2#3{\_dest[cite:\_the\_bibnum]%
+ \_ifx\_wref\_wrefrelax\_else \_immediate\_wref\_Xbib{{#1}{#2}{#3}}\_fi}
+
+\_public \bib ;
+
+ \_doc -----------------------------
+ The `\_printbib` prints the bib-entry itself. You can re-define it if you
+ want different design. The `\_pritbib` starts in horizontal mode after
+ `\noindent` and after the eventual hyperlink destination is inserted.
+ By default, the `\_printbib` sets the indentation
+ by `\hangindent` and prints numeric <bib-marks> by
+ `\llap{[\the\bibnum]}` If `\nonumcitations` then the `\_citelinkA` is not
+ empty and <bib-marks> (`\the\bibnum` nor `\the\bibmark`) are not printed.
+ The text of bib-entry follows. User can create this text manualy
+ using `\bib` command or it is generated automaticaly from a `.bib` database
+ by `\usebib` command.
+
+ The vertical space between bib-entries is controlled by `\_bibskip` macro.
+ \_cod -----------------------------
+
+\_def \_printbib {\_hangindent=\_iindent
+ \_ifx\_citelinkA\_empty \_hskip\_iindent \_llap{[\_the\_bibnum] }\_fi
+}
+\_def \_bibskip {\_ifnum\_bibnum>0 \_smallskip \_fi}
+
+ \_doc -----------------------------
+ The `\usebib` command is implemted in `usebib.opm` file which is loaded
+ when the `\usebib` command is firstly used.
+ The `usebib.opm` file loads the `librarian.tex` for scaning the `.bib`
+ files. This macro is external created by Paul Isambert. This is only one
+ such situation where \OpTeX/ macros depends on an external macro.
+ \_cod -----------------------------
+
+\_def\_usebib{\_par \_opinput {usebib.opm} \_usebib}
+\_def\usebib{\_usebib}
+
+ \_doc -----------------------------
+ The macros above works if all `\cite` (or similar) commands are used
+ before the `\usebib` command is used because `\usebib` prints only such
+ bib-entries their <labels> are saved in the `\_citelist`. But if some
+ `\cite` is used after `\usebib`, then `\usebib` sets `\_addcitelist` to
+ `\_writeXcite`, so such `\cite` saves the information to the
+ `.ref`file in the format `\_Xcite{<label>}`. Such information are copied
+ to `\_citelistB` during reading `.ref` file and `\usebib` concats two
+ lists of <labels> from `\_citelist` and `\_citelistB` and
+ uses this concatenated list.
+ \_cod -----------------------------
+
+\_def\_Xcite#1{\_addto\_citelistB{\_citeI[#1]}}
+\_def\_writeXcite#1{\_openref\_immediate\_wref\_Xcite{{#1}}}
+\_def\_citelistB{}
+
+\_endcode % -------------------------------------
+
+See end of the `usebib.opm` file for documentation about creating style
+files `bib-<style>.opm`.
+
+See end of the `bib-iso690.opm` file for large documentation about `.bib` files
+structure and about usage of `iso690` bib-style.
+
diff --git a/Master/texmf-dist/tex/luatex/optex/colors.opm b/Master/texmf-dist/tex/luatex/optex/colors.opm
new file mode 100644
index 00000000000..52dd349f5e8
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/colors.opm
@@ -0,0 +1,361 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \colordef {Colors <2020-03-07>}
+
+ \_doc -----------------------------
+ We declare internal boolean value `\_iflocalcolor` ad do
+ `\localcolor` as default.
+ \_cod -----------------------------
+
+\_newifi \_iflocalcolor \_localcolortrue
+\_protected\_def \_localcolor {\_localcolortrue}
+\_protected\_def \_nolocalcolor {\_localcolorfalse}
+\_public \localcolor \nolocalcolor ;
+
+ \_doc -----------------------------
+ The basic colors in CMYK are here.
+ \_cod -----------------------------
+
+\_def\Blue {\_setcmykcolor{1 1 0 0}}
+\_def\Red {\_setcmykcolor{0 1 1 0}}
+\_def\Brown {\_setcmykcolor{0 0.67 0.67 0.5}}
+\_def\Green {\_setcmykcolor{1 0 1 0}}
+\_def\Yellow {\_setcmykcolor{0 0 1 0}}
+\_def\Cyan {\_setcmykcolor{1 0 0 0}}
+\_def\Magenta {\_setcmykcolor{0 1 0 0}}
+\_def\Grey {\_setcmykcolor{0 0 0 0.5}}
+\_def\LightGrey {\_setcmykcolor{0 0 0 0.2}}
+\_def\White {\_setgreycolor{1}}
+\_def\Black {\_setgreycolor{0}}
+
+ \_doc -----------------------------
+ By default, `\set/cmyk/rgb/grey/color` macros expands to `\_setcolor{<pdf-primitive>}`
+ We set both types of colors (for lines (`K` or `RG` or `G`) and for fills
+ (`r` or `rg` or `g`) together in the <pdf-primitive> command.
+ \_cod -----------------------------
+
+\_def\_setcmykcolor#1{\_setcolor{\_formatcmyk{#1}}}
+\_def\_setrgbcolor#1{\_setcolor{\_formatrgb{#1}}}
+\_def\_setgreycolor#1{\_setcolor{\_formatgrey{#1}}}
+\_def\_formatcmyk#1{#1 k #1 K}
+\_def\_formatrgb#1{#1 rg #1 RG}
+\_def\_formatgrey#1{#1 g #1 G}
+\_public \setcmykcolor \setrgbcolor \setgreycolor ;
+
+ \_doc -----------------------------
+ The `\onlyrgb` declaration redefines `\_formatcmyk` in ordet it expands
+ to its conversion to RGB <pdf-primitive>. This conversion is done by
+ the `\_cmyktorgb` macro. Moreover, `\onlyrgb` re-defines three basic RGB
+ colors for RGB color space and re-declares `\_colordef` as `\_rgbcolordef`.
+ The `\onlycmyk` macro does a similar work, it re-defines `\_formatrgb`
+ macro. The Grey color space is unnchanged and works in both main
+ settings (RGB or CMYK) without collisions.
+ \_cod -----------------------------
+
+\_def\_onlyrgb{\_def\Red{\_setrgbcolor{1 0 0}}%
+ \_def\Green{\_setrgbcolor{0 1 0}}\_def\Blue{\_setrgbcolor{0 0 1}}%
+ \_let\_colordef=\_rgbcolordef
+ \_def\_formatrgb##1{##1 rg ##1 RG}%
+ \_def\_formatcmyk##1{\_cmyktorgb ##1 ; rg \_cmyktorgb ##1 ; RG}}
+\_def\_onlycmyk{\_def\_formatcmyk##1{##1 k ##1 K}%
+ \_def\_formatrgb##1{\_rgbtocmyk ##1 ; k \_rgbtocmyk ##1 ; K}}
+\_public \onlyrgb \onlycmyk ;
+
+ \_doc -----------------------------
+ The `\_setcolor` macro redefines empty `\_ensureblack` macro (used in
+ output routine for headres and footers) to `\_encureblackA` which keeps
+ Black at start ot its parameter and retunrs to the current color at the
+ end of its parameter. Then the current color
+ is saved into `\_currentcolor` macro and colorstack is pushed.
+ Finally, the `\_colorstackpop` is initialized by `\aftergroup` if
+ `\localcolor` is declared.
+
+ You can save current color to your macro by `\let\yourmacro=\_currentcolor`
+ and you can return to this color by the command `\_setcmykcolor\yourmacro`.
+ \_cod -----------------------------
+
+\_protected\_def \_setcolor #1{\_global\_let\_ensureblack=\_ensureblackA
+ \_iflocalcolor \_edef\_currentcolor{#1}\_colorstackpush\_currentcolor
+ \_aftergroup\_colorstackpop
+ \_else \_xdef\_currentcolor{#1}\_colorstackset\_currentcolor \_fi
+}
+\_def\_pdfblackcolor{0 g 0 G}
+\_edef\_currentcolor{\_pdfblackcolor}
+\_def\_ensureblackA#1{\_colorstackpush\_pdfblackcolor #1\_colorstackpop}
+
+ \_doc -----------------------------
+ The colorstack is initialized here and basic macros
+ `\_colorstackpush`, `\_colorstackpop` and `\_colorstackset`
+ are defined here.
+ \_cod -----------------------------
+
+\_mathchardef\_colorstackcnt=0 % Implicit stack usage
+\_def\_colorstackpush#1{\_pdfcolorstack\_colorstackcnt push{#1}}
+\_def\_colorstackpop{\_pdfcolorstack\_colorstackcnt pop}
+\_def\_colorstackset#1{\_pdfcolorstack\_colorstackcnt set{#1}}
+
+ \_doc -----------------------------
+ We use lua codes for RGB to CMYK or CMYK to RGB conversions and for
+ addition color components in the `\colordef` macro.
+ `\_rgbtocmyk <R> <G> <B> ;` expands to <C> <M> <Y> <K>.
+ `\_cmyktorgb <C> <M> <Y> <K> ;` expands to <R> <G> <B>.
+ The `\_colorcrop`, `\_colordefFin` and `\_douseK` are auxiliary macros
+ used in `\colordef`. The `\colorcrop` rescales color components in order
+ to they are in $[0,1]$ interval. The `\colordefFin` expands to the values
+ accumulated in Lua code `color_C`, `color_M`, `color_Y` and `color_K`.
+ The `\_douseK` applies `\useK` to CMYK components.
+ \_cod -----------------------------
+
+\_def\_rgbtocmyk #1 #2 #3 ;{%
+ \_ea \_stripzeros \_directlua{
+ local kr = math.max(#1,#2,#3)
+ if (kr==0) then
+ tex.print('0. 0. 0. 1 ;')
+ else
+ tex.print(string.format('\_pcent.3f \_pcent.3f \_pcent.3f \_pcent.3f ;',
+ (kr-#1)/kr, (kr-#2)/kr, (kr-#3)/kr, 1-kr))
+ end
+}}
+\_def\_cmyktorgb #1 #2 #3 #4 ;{%
+ \_ea \_stripzeros \_directlua{
+ local kr = 1-#4
+ tex.print(string.format('\_pcent.3f \_pcent.3f \_pcent.3f ;',
+ (1-#1)*kr, (1-#2)*kr, (1-#3)*kr))
+}}
+\_def\_colorcrop{\_directlua{
+ local m=math.max(color_C, color_M, color_Y, color_K)
+ if (m>1) then
+ color_C=color_C/m color_M=color_M/m color_Y=color_Y/m color_K=color_K/m
+ end
+}}
+\_def\_colordefFin{\_colorcrop \_ea \_stripzeros \_directlua{
+ tex.print(string.format('\_pcent.3f \_pcent.3f \_pcent.3f \_pcent.3f ;',
+ color_C, color_M, color_Y, color_K))
+}}
+\_def\_douseK{\_colorcrop \_directlua{
+ kr=math.min(color_C, color_M, color_Y)
+ if (kr>=1) then
+ color_C=0 color_M=0 color_Y=0 color_K=1
+ else
+ color_C=(color_C-kr)/(1-kr) color_M=(color_M-kr)/(1-kr)
+ color_Y=(color_Y-kr)/(1-kr) color_K=math.min(color_K+kr,1)
+ end
+}}
+
+ \_doc -----------------------------
+ We have a problem with the `%.3f` directive in Lua code. It prints trailed
+ zeros: (0.300 instead desired 0.3) but we want to save PDF file space. The macro
+ `\_stripzeros` removes these trailing zeros at expand processor
+ level. So `\_stripzeros 0.300 0.400 0.560 ;` expands to `.3 .4 .56`.
+ \_cod -----------------------------
+
+\_def\_stripzeros #1.#2 #3{\_ifx0#1\_else#1\_fi.\_stripzeroA #2 0 :%
+ \_ifx;#3\_else \_space \_ea\_stripzeros\_ea#3\_fi}
+\_def\_stripzeroA #10 #2:{\_ifx^#2^\_stripzeroC#1:\_else \_stripzeroB#1 0 :\_fi}
+\_def\_stripzeroB #10 #2:{\_ifx^#2^\_stripzeroC#1:\_else #1\_fi}
+\_def\_stripzeroC #1 #2:{#1}
+
+ \_doc -----------------------------
+ The `\rgbcolordef` and `\cmykcolordef` use common macro
+ `\_commoncolordef` with different first four parameters.
+ The `\_commoncolordef <selector><K><R><G><what-define>{<data>}` does the
+ real work. It initializes the Lua variables for summation.
+ It expands <data> in the group where color selectors have
+ special meaning, then it adjusts the resulting string by `\replstring`
+ and runs it. Example shows how the <data> are processed:
+ \begtt
+ input <data>: ".3\Blue +.6^\KhakiC \useK -\Black"
+ expanded to: ".3 !=K 1 1 0 0 +.6^!=R .804 .776 .45 \_useK -!=G 0"
+ adjusted to: "\_addcolor .3!=K 1 1 0 0 \_addcolor .6!^R .804 .776 .45
+ \_useK \_addcolor -1!=G 0"
+ and this is processed.
+ \endtt
+ `\_addcolor <coef.>!<mod><type>` expands to `\_addcolor:<mod><type> <coef>`
+ for example to `\_addcolor:=K <coef>` followed by one or three or four
+ numbers (depending on <type>). <mod> is `=` (use as is) or `^` (use
+ complementary color). <type> is `K` for CMYK, `R` for RGB and `G` for
+ GREY color space. Uppercase <type> informs that `\cmykcolordef` is
+ processed and lowercase <type> informs that `\rgbcolordef` is processed.
+ All variants of commands `\_addcolor:<mod><type>` are defined. All of
+ them expand to `\_addcolorA <v1> <v2> <v3> <v4>` which adds the values of Lua
+ variables. The `\rgbcolordef` uses `\_addcolorA <R> <G> <B> 0` and
+ `\cmkykcolordef` uses `\_addcolorA <C> <M> <Y> <K>`. So the Lua variable
+ names are a little confusing when `\rgbcolordef` is processed.
+
+ Next, `\_commoncolordef` saves resulting values from Lua to `\_tmpb`
+ using `\_colordefFin`. If `\rgbcolordef` is processed, then we must to
+ remove the last <K> component which is in the format `.0` in such case.
+ The `\_stripK` macro does it.
+ Finaly, the <what-define> is defined as `<selector>{<expanded _tmpb>}`.
+ \_cod -----------------------------
+
+\_def\_rgbcolordef {\_commoncolordef \_setrgbcolor krg}
+\_def\_cmykcolordef {\_commoncolordef \_setcmykcolor KRG}
+\_def\_commoncolordef#1#2#3#4#5#6{%
+ \_begingroup
+ \_directlua{color_C=0 color_M=0 color_Y=0 color_K=0}%
+ \_def\_setcmykcolor##1{!=#2 ##1 }%
+ \_def\_setrgbcolor ##1{!=#3 ##1 }%
+ \_def\_setgreycolor##1{!=#4 ##1 }%
+ \_let\_useK=\_relax
+ \_edef\_tmpb{+#6}%
+ \_replstring\_tmpb{+}{\_addcolor}\_replstring\_tmpb{-}{\_addcolor-}%
+ \_replstring\_tmpb{^!=}{!^}\_replstring\_tmpb{-!}{-1!}%
+ \_ifx K#2\_let\_useK=\_douseK \_fi
+ \_tmpb
+ \_edef\_tmpb{\_colordefFin}%
+ \_ifx k#2\_edef\_tmpb{\_ea\_stripK \_tmpb;}\_fi
+ \_ea\_endgroup
+ \_ea\_def\_ea#5\_ea{\_ea#1\_ea{\_tmpb}}%
+}
+\_def\_addcolor#1!#2#3{\_cs{addcolor:#2#3}#1}
+\_def\_addcolorA #1 #2 #3 #4 #5 {%
+ \_def\_tmpa{#1}\_ifx\_tmpa\_empty \_else \_edef\_tmpa{\_tmpa*}\_fi
+ \_directlua{color_C=math.max(color_C+\_tmpa#2,0)
+ color_M=math.max(color_M+\_tmpa#3,0)
+ color_Y=math.max(color_Y+\_tmpa#4,0)
+ color_K=math.max(color_K+\_tmpa#5,0)
+}}
+\_sdef{addcolor:=K}#1 #2 #3 #4 #5 {\_addcolorA #1 #2 #3 #4 #5 }
+\_sdef{addcolor:^K}#1 #2 #3 #4 #5 {\_addcolorA #1 (1-#2) (1-#3) (1-#4) #5 }
+\_sdef{addcolor:^G}#1 #2 {\_addcolorA #1 0 0 0 #2 }
+\_sdef{addcolor:=G}#1 #2 {\_addcolorA #1 0 0 0 (1-#2) }
+\_sdef{addcolor:=R}#1 #2 #3 #4 {%
+ \_edef\_tmpa{\_noexpand\_addcolorA #1 \_rgbtocmyk #2 #3 #4 ; }\_tmpa
+}
+\_sdef{addcolor:^R}#1 #2 #3 #4 {\_cs{addcolor:=R}#1 (1-#2) (1-#3) (1-#4) }
+
+\_sdef{addcolor:=k}#1 #2 #3 #4 #5 {%
+ \_edef\_tmpa{\_noexpand\_addcolorA #1 \_cmyktorgb #2 #3 #4 #5 ; 0 }\_tmpa
+}
+\_sdef{addcolor:^k}#1 #2 #3 #4 #5 {\_cs{addcolor:=k}#1 (1-#2) (1-#3) (1-#4) #5 }
+\_sdef{addcolor:^g}#1 #2 {\_addcolorA #1 (1-#2) (1-#2) (1-#2) 0 }
+\_sdef{addcolor:=g}#1 #2 {\_addcolorA #1 #2 #2 #2 0 }
+\_sdef{addcolor:=r}#1 #2 #3 #4 {\_addcolorA #1 #2 #3 #4 0 }
+\_sdef{addcolor:^r}#1 #2 #3 #4 {\_addcolorA #1 (1-#2) (1-#3) (1-#4) 0 }
+\_def\_stripK#1 .0;{#1}
+\_let\_colordef=\_cmykcolordef % default \_colordef is \_cmykcolordef
+
+ \_doc -----------------------------
+ Public versions of `\colordef` and `\useK` macros are declared using
+ `\_def`, because the internal versions `\_colordef` and `\_useK` are
+ changed during processing.
+ \_cod -----------------------------
+
+\_def \useK{\_useK}
+\_def \colordef {\_colordef}
+\_public \cmykcolordef \rgbcolordef ;
+
+ \_doc -----------------------------
+ The \LaTeX/ file `x11nam.def` is read by `\morecolors`. The numbers
+ 0,1,2,3,4 are trasformed to letters O, <none>, B, C, D in the name of the
+ color. Colors defined already are not re-defined. The empty \_showcolor`
+ macro should be re-defined for color catalog printing. For example:
+ \begtt
+ \def\vr{\vrule height10pt depth2pt width20pt}
+ \def\_showcolor{\hbox{\tt \_bslash\_tmpb: \csname \_tmpb\endcsname \vr}\space\space}
+ \typosize[11/14] \begmulti 4
+ \morecolors
+ \endmulti
+ \endtt
+ \_cod -----------------------------
+
+\_def\_morecolors{%
+ \_long\_def\_tmp##1\preparecolorset##2##3##4##5{\_tmpa ##5;,,,;}
+ \_def\_tmpa##1,##2,##3,##4;{\_ifx,##1,\_else
+ \_def\_tmpb{##1}\_replstring\_tmpb{1}{}\_replstring\_tmpb{2}{B}%
+ \_replstring\_tmpb{3}{C}\_replstring\_tmpb{4}{D}\_replstring\_tmpb{0}{O}%
+ \_ifcsname \_tmpb\_endcsname \_else
+ \_sdef{\_tmpb}{\_setrgbcolor{##2 ##3 ##4}}\_showcolor\_fi
+ \_ea\_tmpa\_fi
+ }
+ \_ea\_tmp\_input x11nam.def
+}
+\_let\_showcolor=\_relax % re-define it if you want to print a color catalog
+\_public \morecolors ;
+
+\_endcode % -------------------------------------
+
+The colors have different behavior than fonts. A marks (whatsits) with color
+information are stored into PDF output and \TeX/ doesn't interpret them.
+The PDF viewer (or PDF interpreter in a printer) reads these marks
+and switches colors according to them. This
+is totally independent on \TeX/ group mechanism. You can declare
+`\nolocalcolor` at the beginning of the document, if you want this behavior.
+In this case, if you set a color then you must to return back to black color
+using `\Black` manualy.
+
+By default, \OpTeX/ sets `\localcolor`. It means that the typesetting
+returns back to a previous color at the end of current group, so you cannot
+write `\Black` explicitly. This is implemented using `\afterroup` feature.
+There is a limitiation of this feature: when a color selector is used in a
+group of a box, which is saved by `\setbox`, then the activity or
+recontruction of previous color are processed at `\setbox` time, no in the
+box itself. You must to correct it by double group:
+\begtt
+\setbox=\hbox{\Red something} % bad: the \Black is done after \setbox
+\setbox=\hbox{{\Red something}} % good: the \Black is done after group inside the box
+\endtt
+
+The implementation of colors is based on colorstack, so the current color
+can follow acros more pages. It is not so obvious because PDF viewer (or PDF
+interpreter) manipulates with colors locally at each PDF page and it
+initializes each PDF page with black on white color.
+
+Macros `\setcmykcolor{<C> <M> <Y> <K>}` or `\setrgbcolor{<R> <G> <B>}`
+or `\_setgreycolor{<Grey>}` should be used in color selectors or user can
+specify these macros explicitly.
+
+The color mixing processed by `\colordef` is done in the substractive color
+model CMYK. If the result has a component greater than 1 then all
+components are multiplied by a coefficient in order to maximal component is
+equal to 1.
+
+You can move a common amount of CMY components (i.e. their minimum) to the
+$K$ component. This saves the color tonners and the result is more true.
+This should be done by `\useK` command at the end of a linear combination
+used in `\colordef`. For example
+$$
+ \colordef \myColor {.3\Green + .4\Blue \useK}
+$$
+The `\useK` command exactly does:
+$$
+ k' =\min(C,M,Y), \ C=(C-k')/(1-k'), \ M=(M-k')/(1-k'), \ Y=(Y-k')/(1-k'), \
+ K = \min(1,K+k').
+$$
+
+You can use minus instead plus in the linear combination in `\colordef`. The
+given color is substracted in such case and the negative components are
+rounded to zero immediately. For example
+\begtt
+\colordef \Color {\Brown-\Black}
+\endtt
+can be used for removing black component from the color. You can use
+the `-\Black` trick after `\useK` command in order to remove grey components
+occured during color mixing.
+
+Finally, you can use `^` immediately preceeded before macro name of the
+color. Then the complementary color is used here.
+\begtt
+\colordef \mycolor {\Grey + .6^\Blue} % the same as \colordef\mycolor{\Grey+.6\Yellow}
+\endtt
+
+The `\rgbcolordef` can be used to mix colors in additive color model RGB.
+If `\onlyrgb` is declared, then `\colordef` works as `\rgbcolordef`.
+
+If a CMYK to RGB or RGB to CMYK conversion is needed then no ICC profiles are
+supposed, but only the following simple formulae are used
+$$
+\displaylines{
+ \hbox{CMYK to RGB:}\quad
+ R = (1-C)(1-K), \ G = (1-M)(1-K), \ B = (1-Y)(1-K). \cr
+ \hbox{RGB to CMYK:}\quad
+ K'=\max(R,G,B), \ C=(K'-R)/K', \ M=(K'-G)/K', \ Y=(K'-B)/K', \ K=1-K'.
+}
+$$
+The RGB to CMYK conversion is invoked when a color is declared using `\setrgbcolor`
+and it is used in `\colordef` or if it is printed when `\onlycmyk` is declared.
+The CMYK to RGB conversion is invoked when a color is declared using `\setcmykcolor`
+and it is used in `\rgbcolordef` or if it is printed when `\onlyrgb` is declared.
+
+
diff --git a/Master/texmf-dist/tex/luatex/optex/csplain-params.opm b/Master/texmf-dist/tex/luatex/optex/csplain-params.opm
deleted file mode 100644
index f92d19ffcef..00000000000
--- a/Master/texmf-dist/tex/luatex/optex/csplain-params.opm
+++ /dev/null
@@ -1,24 +0,0 @@
-%% This is part of OpTeX project, see http://petr.olsak.net/optex
-
-\_codedecl \uv {CSplain settings for backward compatibiity <2020-01-23>}
-
-
-% for compatibility with csplain:
-
-\_chardef\clqq=8222 \_chardef\crqq=8220
-\_chardef\flqq=171 \_chardef\frqq=187
-\_chardef\promile=8240
-
-\_def\uv#1{\clqq#1\crqq}
-
-\_let\uslang=\enlang \_let\ehyph=\enlang
-\_let\chyph=\cslang \_let\shyph=\sklang
-\_let\csUnicode=\csPatt \_let\czUnicode=\csPatt \_let\skUnicode=\skPatt
-
-\_let \letfont = \_fontlet
-
-\_endcode
-
-These codes are usable only after Unicode font is loaded using \fontfam.
-If you don't use Unicode fonts then more characters from Czech language stay
-unavailable (ř, ů, for example). See the notice in `fonts-preoad.opm`.
diff --git a/Master/texmf-dist/tex/luatex/optex/f-lmfonts.opm b/Master/texmf-dist/tex/luatex/optex/f-lmfonts.opm
index 7a7c7527afe..3daf7045ceb 100644
--- a/Master/texmf-dist/tex/luatex/optex/f-lmfonts.opm
+++ b/Master/texmf-dist/tex/luatex/optex/f-lmfonts.opm
@@ -15,7 +15,7 @@ Modifiers (selects subfamily):^^J
\ttlight ... light typewriter subfamily^^J
\ttcond .... condensed typewriter subfamily^^J
\upital .... upright italic (only \rm)^^J
- \dunhill ... dunhill roman subfamily (only \rm, \it)^^J
+ \dunhill ... dunhill roman subfamily (only \rm, \it)^^J%
Submodifiers (setlects special variants of given subfamily):^^J
\caps ...... caps & small caps (available only at limited shapes)^^J
\slant ..... slanted (default in some subfamilies)^^J
diff --git a/Master/texmf-dist/tex/luatex/optex/fams-ini.opm b/Master/texmf-dist/tex/luatex/optex/fams-ini.opm
index fca923963c5..f9d3110f139 100644
--- a/Master/texmf-dist/tex/luatex/optex/fams-ini.opm
+++ b/Master/texmf-dist/tex/luatex/optex/fams-ini.opm
@@ -10,6 +10,7 @@
\_faminfo [Latin Modern] {TeX Gyre fonts based on Coputer Modern} {f-lmfonts}
{ -,\nbold,\sans,\sans\nbold,\slant,\ttset,\ttset\slant,\ttset\caps,%
\ttprop,\ttprop\bolder,\quotset: {\rm\bf\it\bi}
+ \caps: {\rm\it}
\ttlight,\ttcond,\dunhill: {\rm\it} \upital: {\rm} }
\_famalias [LMfonts] \_famalias [Latin Modern Fonts]
diff --git a/Master/texmf-dist/tex/luatex/optex/fnotes.opm b/Master/texmf-dist/tex/luatex/optex/fnotes.opm
new file mode 100644
index 00000000000..97982e7266e
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/fnotes.opm
@@ -0,0 +1,157 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \fnote {Footnotes, marginal notes OpTeX <2020-03-11>}
+
+ \_doc -----------------------------
+ \begitems
+ * `\_gfnotenum` is conter which counts footnotes globaly in the document.
+ whole document, chapters, pages.
+ * `\_lfnotenum` is counter which counts footnotes at each chapter from one.
+ It is used for local page footnote counters too.
+ * `\_ifpgfnote` says that footnote numbers are counted on each page from
+ one. We need to run `\openref` in such case.
+ * `\fnotenum` is a macro which expands to footnote number counted in declared part.
+ \enditems
+ \_cod -----------------------------
+
+\_newcount\_gfnotenum \_gfnotenum=0
+\_newcount\_lfnotenum
+
+\_newifi \_ifpgfnote
+\_def \_fnotenumglobal {\def\_fnotenum{\_the\_gfnotenum}\_pgfnotefalse}
+\_def \_fnotenumchapters {\def\_fnotenum{\_the\_lfnotenum}\_pgfnotefalse}
+\_def \_fnotenumpages {\def\_fnotenum{\_trycs{_fn:\_the\_gfnotenum}{?}}\_pgfnotetrue}
+\_fnotenumchapters % default are footnotes counted from one in each chapter
+\_def \fnotenum{\_fnotenum}
+\_public \fnotenumglobal \fnotenumchapters \fnotenumpages ;
+\_let \runningfnotes = \fnotenumglobal % for backward compatibility
+
+ \_doc -----------------------------
+ The `\_printfnotemark` prints the footnote mark. You can re-define this
+ macro if you want another design of footnotes. For example
+ \begtt
+ \fnotenumpages
+ \def \_printfnotemark {\ifcase 0\fnotenum\or
+ *\or**\or***\or$^\mathbox{†}$\or$^\mathbox{‡}$\or$^\mathbox{††}$\fi}
+ \endtt
+ This code gives footnotes* and ** and*** and† etc.
+ and it supposes that there are no more than 6 footnotes at one page.
+ \_cod -----------------------------
+
+\_def \_printfnotemark {$^{\_fnotenum}$} % default fnote mark
+
+ \_doc ----------------------------
+ Each footnote saves the `\_Xfnote` (without parameter) to the `.ref`
+ file (if `\openref`). We can create the mapping from <gfnotenum> to <pgfnotenum>
+ in the macro `\_fn:<fnotenum>`. Each `\_Xpage` macro sets the `\_pgfnote` to zero.
+ \_cod ----------------------------
+
+\_def \_Xfnote {\_incr\_lfnotenum \_incr\_gfnotenum
+ \_sxdef{_fn:\_the\_gfnotenum}{\_the\_lfnotenum}}
+
+ \_doc ----------------------------
+ The `\fnote {<text>}` macro is simple, but `\fnotemark`, `\fnotetext`
+ does the real work.
+ \_cod ----------------------------
+
+\_def\_fnote{\_fnotemark1\_fnotetext}
+\_def\_fnotemark#1{{\_advance\_gfnotenum by#1\_advance\_lfnotenum by#1\relax \_printfnotemark}}
+
+ \_doc ----------------------------
+ The `\_fnotetext` calls `\_opfootnote` which is equivalent to plain \TeX/
+ `\vfootnote`. It creates new data to Insert `\_footins`. The only
+ difference is that we are able to propagate a macro into Insert group
+ before the text is printed (see section \ref[output]).
+ This propageted macro is `\_fnset` which applies the `\everyfonte` and sets
+ smaller fonts.
+
+ Note that `\vfootnote` and `\_opfootnote` does't read the text as a
+ parameter but during normal horizontal mode. This is reason why catcode
+ changes (for example in-line verbaptim) can be used here.
+ \_cod ----------------------------
+
+\_def\_fnotetext{\_incr\_gfnotenum \_incr\_lfnotenum % global increment
+ \_ifpgfnote \_openref \_fi
+ \_wref \_Xfnote{}%
+ \_ifpgfnote \_ifcsname _fn:\_the\_gfnotenum \_endcsname \_else
+ \_opwarning{unknown \_noexpand\fnote mark. TeX me again}
+ \_fi\_fi
+ \_opfootnote\_fnset\_printfnotemark
+}
+\_def\_fnset{\_everypar={}\_the\_everyfnote \_scalemain \_typoscale[800/800]}
+
+\_public \fnote \fnotemark \fnotetext ;
+
+ \_doc -----------------------------
+ By default `\mnote` are in right margin at odd pages and they are in left
+ margin at even pages. The `\mnote` macro saves its position to `.ref`
+ file as `\_Xmnote` without parameter. We define `\_mn:<mnotenum>` as
+ `\right` or `\left` when the `.ref` file is read.
+ The `\ifnum 0`$\le$`0#2` trick teturs true if <pageno> has numeric type and false
+ if it is non-numeric type (romannnumeral, for example). We prefer to use
+ <pageno>, but only if it has numeric type. We use <gpageno> in other cases.
+ \_cod -----------------------------
+
+\_newcount\_mnotenum \_mnotenum=0 % global counter of mnotes
+\_def \_Xmnote {\_incr\_mnotenum \_ea \_XmnoteA \_currpage}
+\_def \_XmnoteA #1#2{% #1=<gpageno> #2=<pageno>
+ \_sxdef{_mn:\_the\_mnotenum}{\_ifodd\_numtype{#2}{#1} \_right \_else \_left \_fi}}
+\_def \_numtype #1#2{\_ifnum 0<0#1 #1\_else #2\_fi}
+
+ \_doc -----------------------------
+ User can declare `\fixmnotes\left` or `\fixmnotes\right`. It defines
+ `\_mnotesfixed` as `\_left` or `\_right` which declares the placement
+ of all marginal notes and such declaration has a precedence.
+ \_cod -----------------------------
+
+\_def \_fixmnotes #1{\_edef\_mnotesfixed{\_cs{_\_csstring #1}}}
+\_public \fixmnotes ;
+
+ \_doc -----------------------------
+ The outer box of marginal note has zero width and zero depth and it is appended
+ after current line using `\vadjust` primitive or it is inverted to vertical mode
+ as a box with `\vskip-\baselineskip` followed.
+ \_cod -----------------------------
+
+\_long\_def\_mnote#1{\_ifvmode {\_mnoteA{#1}}\_nobreak\_vskip-\_baselineskip \_else
+ \_lower\_dp\_strutbox\_hbox{}\_vadjust{\_kern-\_dp\_strutbox \_mnoteA{#1}\_kern\_dp\_strutbox}%
+ \_fi
+}
+\_public \mnote ;
+
+ \_doc -----------------------------
+ The `\_mnoteA` macro does the real work. The `\_lrmnote{<left>}{<right>}`
+ uses only first or only second parameter dependng on the left or right
+ marginal note.
+ \_cod -----------------------------
+
+\_long\_def\_mnoteA #1{\_incr\_mnotenum
+ \_ifx\_mnotesfixed\_undefined
+ \_ifcsname _mn:\_the\_mnotenum \_endcsname
+ \_edef\_mnotesfixed{\_cs{_mn:\_the\_mnotenum}}%
+ \_else
+ \_opwarning{unknown \_noexpand\mnote side. TeX me again}\_openref
+ \_def\_mnotesfixed{\_right}%
+ \_fi\_fi
+ \_hbox to0pt{\_wref\_Xmnote{}\_everypar={}%
+ \_lrmnote{\_kern-\_mnotesize \_kern-\_mnoteindent}{\_kern\_hsize \_kern\_mnoteindent}%
+ \_vbox to0pt{\_vss \_setbox0=\_vtop{\_hsize=\_mnotesize
+ \_lrmnote{\_leftskip=0pt plus 1fill \_rightskip=0pt}
+ {\_rightskip=0pt plus 1fil \_leftskip=0pt}%
+ {\_the\_everymnote\_noindent#1\_endgraf}}%
+ \_dp0=0pt \_box0 \_kern\_mnoteskip \_global\_mnoteskip=0pt}\_hss}%
+}
+\_def \_lrmnote#1#2{\_ea\_ifx\_mnotesfixed\_left #1\_else #2\_fi}
+
+ \_doc -----------------------------
+ We don't want to process `\fnote`, `\fnotemark`, `\mnote` in TOC, headlines
+ nor outlines.
+ \_cod -----------------------------
+
+\_regmacro {\_def\fnote#1{}} {\_def\fnote#1{}} {\_def\fnote#1{}}
+\_regmacro {\_def\fnotemark#1{}} {\_def\fnotemark#1{}} {\_def\fnotemark#1{}}
+\_regmacro {\_def\mnote#1{}} {\_def\mnote#1{}} {\_def\mnote#1{}}
+
+\_endcode % -------------------------------------
+
+
diff --git a/Master/texmf-dist/tex/luatex/optex/fonts-opmac.opm b/Master/texmf-dist/tex/luatex/optex/fonts-opmac.opm
index 52afb97650f..c7a83389954 100644
--- a/Master/texmf-dist/tex/luatex/optex/fonts-opmac.opm
+++ b/Master/texmf-dist/tex/luatex/optex/fonts-opmac.opm
@@ -87,8 +87,8 @@
\_protected\_def \_boldify {%
\_let \_setmainvalues=\_setmainvaluesL
- \_let\it =\_bi \_let\rm =\_bf \_let\normalmath =\_boldmath
- \_let\_it=\_bi \_let\_rm=\_bf \_let\_normalmath=\_boldmath \_rm
+ \_let\it =\_bi \_let\rm =\_bf \_let\_normalmath=\_boldmath
+ \_let\_it=\_bi \_let\_rm=\_bf \_rm
}
\_public \typosize \typoscale \thefontsize \thefontscale \em \boldify
\scalemain \mainfosize \mainbaselineskip ;
diff --git a/Master/texmf-dist/tex/luatex/optex/fonts-resize.opm b/Master/texmf-dist/tex/luatex/optex/fonts-resize.opm
index c686b85b798..15f06661ff0 100644
--- a/Master/texmf-dist/tex/luatex/optex/fonts-resize.opm
+++ b/Master/texmf-dist/tex/luatex/optex/fonts-resize.opm
@@ -8,6 +8,7 @@
\_edef\_whatresize{#1}%
\_ifx \_fontselector \_undefined \_doresizefont#2%
\_else \_ea \_doresizefont \_fontselector \_fi
+ \_lastmagsize=0pt
\_slet{_tryload#1}{_relax}%
}
\_def\_doresizetfmfont#1{\_logfont{#1}%
@@ -35,14 +36,19 @@
\_loadf{it}\_tenit \_loadf{bi}\_tenbi
}
\_def\_loadf#1#2{\sdef{_tryload#1}{\_ifmmode \_else \_resizefont{#1}#2\_fi}}
-\_def\_tryloadtt{\fontlet\_tentt=\_tentt \_sizespec\_relax}
+\_def\_tryloadtt{\_resizefont{tt}\_tentt}
\_def\_setoptsize {\_isnextchar a{\_setoptsizeA}
{\_isnextchar m{\_setoptsizeC}{\_setoptsizeB}}}
-\_def\_setoptsizeA at#1\_relax{\_optsize=#1\_relax} % at<dimen>
-\_def\_setoptsizeB #1\_relax{\_optsize=\_defaultoptsize\_relax} % scaled<scalenum>
+\_def\_setoptsizeA at#1\_relax{\_optsize=#1\_relax\_lastmagsize=\_optsize} % at<dimen>
+\_def\_setoptsizeB scaled#1\_relax{\_optsize=\_defaultoptsize\_relax} % scaled<scalenum>
\_def\_setoptsizeC mag#1\_relax{%
- \_optsize=\_pdffontsize\_font \_optsize=#1\_optsize \_edef\_sizespec{at\_the\_optsize}}
+ \_ifdim\_lastmagsize>0pt \_optsize=\_lastmagsize \_else \_optsize=\_pdffontsize\_font \_fi
+ \_optsize=#1\_optsize
+ \_lastmagsize=\_optsize
+ \_edef\_sizespec{at\_the\_optsize}}
+
+\_newdimen\_lastmagsize
\_setfontsize{at10pt} % default size
\_let\_tryloadrm=\_relax
@@ -97,11 +103,14 @@
\_csname \_tmp\_endcsname
}
-\_def \_truetenrm {% used in default \footline
- \_fontdef\_truetenrm{\_setfontsize{at10pt}\rm}%
- \_global\_let\_truetenrm=\_truetenrm % next use will be font switch only
- \_truetenrm
+\_def \_rmfixed {% used in default \footline
+ {\_ifdim\_mainfosize=0pt \_mainfosize=10pt \_fi
+ \_fontdef\_rmfixed{\_setfontsize{at\mainfosize}\_resetmod\_rm}%
+ \_global\_let\_rmfixed=\_rmfixed} % next use will be font switch only
+ \_rmfixed
}
+\_let \rmfixed = \_tenrm % user can redefine it
+
%% Optical sizes data for preloaded Latin Modern fonts:
diff --git a/Master/texmf-dist/tex/luatex/optex/fonts-select.opm b/Master/texmf-dist/tex/luatex/optex/fonts-select.opm
index 0bdc0acfd48..da010893332 100644
--- a/Master/texmf-dist/tex/luatex/optex/fonts-select.opm
+++ b/Master/texmf-dist/tex/luatex/optex/fonts-select.opm
@@ -92,25 +92,25 @@
\_ea \_public \_csname\_tmp\_endcsname ;\_fi
}
\_protected \_def\_resetmod {\_cs{_f:\_currfamily:resetmod}} % private variant of \resetmod
+\_def\_currfamily{} % default current family is empty
\_def\_famdepend#1#2{\_ifcsname#2\_endcsname \_csname#2\_ea\_endcsname \_else
\_opwarning{\string#1 is undeclared in current family "\_currfamily", ignored}\_fi
}
\_def\_famvardef#1{\_edef\_tmp{\_csstring#1}\_remfirstunderscore\_tmp
\_ea\_famvardefA \_ea#1\_csname _ten\_tmp\_ea\_endcsname
- \_csname _tryload\_tmp\_ea\_endcsname \_csname \_tmp\_endcsname
+ \_csname _tryload:\_tmp\_endcsname
}
-\_def\_famvardefA #1#2#3#4#5{% #1=\_XX #2=\_tenXX #3=\_tryloadXX #4=\XX #5=data
- \_isinlist{.\rm\bf\it\bi\currvar}#4\iftrue
+\_def\_famvardefA #1#2#3#4{% #1=\_XX #2=\_tenXX #3=\_tryloadXX #4=data
+ \_isinlist{.\_rm\_bf\_it\_bi\currvar\_currvar}#1\iftrue
\_opwarning{\string\famvardef:
- You cannot re-declare standard variant selector \string#4}%
+ You cannot re-declare private standard variant selector \string#1}%
\_else
\_protected\_edef #1{\noexpand\_famdepend\noexpand#1{_f:\noexpand\_currfamily:\_tmp}}%
\_sdef{_f:\_currfamily:\_tmp}{#3#2}%
- \_def#3{\_fontdef#2{\_reloading#5}}%
+ \_def#3{\_fontdef#2{\_reloading#4}}%
\_ifx#1\tt \addto#1{\_fam\_ttfam}\fi
\_sdef{_currvar:\csstring#2}{#1}%
- \_ifx#1#4\_else \_public#4;\_fi
\_fi
}
\_def\_initfontfamily{%
diff --git a/Master/texmf-dist/tex/luatex/optex/graphics.opm b/Master/texmf-dist/tex/luatex/optex/graphics.opm
new file mode 100644
index 00000000000..2ce9ba76340
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/graphics.opm
@@ -0,0 +1,49 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \inspic {Graphics <2020-02-29>}
+
+ \_doc -----------------------------
+ `\inspic` accepts old syntax `\inspic <filename><space>`
+ or new syntax `\inspic{<filename>}`. So, we need to define
+ two auxiliary macros `\_inspicA` and `\_inspicB`.
+
+ You can include more `\pdfximage` parameters (like `page=`)
+ in the `\_picparams` macro.
+
+ All `\inspic` macros are surrounded in `\hbox` in order user can
+ write `\moveright\inspic ...` or something similar.
+ \_cod \_fin -----------------------
+
+\_def\_inspic{\hbox\bgroup\_isnextchar\_bgroup\_inspicB\_inspicA}
+\_def\_inspicA #1 {\_inspicB {#1}}
+\_def\_inspicB #1{%
+ \_pdfximage \_ifdim\_picwidth=0pt \_else width\_picwidth\_fi
+ \_ifdim\_picheight=0pt \_else height\_picheight\_fi
+ \_picparams {\_the\_picdir#1}%
+ \_pdfrefximage\_pdflastximage\egroup}
+
+\_def\_picparams{}
+
+\_public \inspic ;
+
+ \_doc ----------------------------
+ `\pdfscale` and `\pdfrotate` macros are implemented by `\pdfsetmatrix`
+ primitive. or rotating we need to knos values of sin, cos function.
+ We use Lua code for this.
+ \_cod ----------------------------
+
+\_def\_pdfscale#1#2{\_pdfsetmatrix{#1 0 0 #2}}
+
+\_def\_gonfunc#1#2{%
+ \_directlua{tex.print(string.format('\_pcent.4f',math.#1(3.14159265*(#2)/180)))}%
+}
+\_def\_sin{\_gonfunc{sin}}
+\_def\_cos{\_gonfunc{cos}}
+
+\_def\_pdfrotate#1{\_pdfsetmatrix{\_cos{#1} \_sin{#1} \_sin{(#1)-180} \_cos{#1}}}
+
+\_public \pdfscale \pdfrotate ;
+
+\_endcode % -------------------------------------
+
+
diff --git a/Master/texmf-dist/tex/luatex/optex/hyperlinks.opm b/Master/texmf-dist/tex/luatex/optex/hyperlinks.opm
index 891ae41f492..1cf48ac945e 100644
--- a/Master/texmf-dist/tex/luatex/optex/hyperlinks.opm
+++ b/Master/texmf-dist/tex/luatex/optex/hyperlinks.opm
@@ -1,8 +1,19 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \urllink {references <2020-02-22>}
+\_codedecl \ulink {Hyperlinks <2020-02-22>}
-%> \dest
+\_newcount \_tocrefnum
+
+ \_doc ----------------------------
+ `\dest[<type>:<spec>]` creates a destination of internal links. The
+ destination is declared by `<type>:<spec>`. If `\hyperlinks` are not
+ declared, then `\dest` does nothing else it is set to `\_destactive`.
+ The `\_destactive` is implemented by `\_pdfdest` primitive. It creates a box
+ in which the destination is shifted by `\_destheight`. The reason is that
+ the destination is exactly at top border of the PDF viewer but we want to se
+ the line where destination is. The destination box is positioned by
+ different way dependent on current vertical or horizontal mode.
+ \_cod ----------------------------
\_def\_destheight{1.4em}
\_def\_destactive[#1:#2]{\_if$#2$\_else\_ifvmode
@@ -15,7 +26,17 @@
\_def\_dest[#1]{}
\_public \dest ;
-%> \_link, \ilink
+ \_doc ----------------------------
+ `\_link[<type>:<spec>]{<color>}{<text>}` creates an internal link to `\dest`
+ with the same `<type>:<spec>`. You can have more links with the same
+ `<type>:<spec>` but only one `\dest` in the document. If `\hyperlinks` are
+ not declared, then `\link` only prints <text> else it is set to `\_linkactive`.
+ The `\_linkactive` is implemented by `\_pdfstartlink...\_pdfendlink`
+ primitives.
+
+ `\ilink[<type>:<spec>]{<text>}` is equivalent to `\_link` but <color> is
+ used from `\hyperlinks` decaration.
+ \_cod ----------------------------
\_protected\_def\_linkactive[#1:#2]#3#4{\_leavevmode\_pdfstartlink height.9em depth.3em
\_pdfborder{#1} goto name{#1:#2}\_relax {#3#4}\_pdfendlink
@@ -24,7 +45,13 @@
\_protected\_def\_ilink[#1]#2{\_leavevmode{#2}}
\_public \ilink ;
-%> \ulink
+ \_doc ----------------------------
+ `\ulink[<url>]{<text>}` creates external link. It prints only <text> by default but
+ the `\hyperlinks` declaration defines it as `\_urlactive[url:<url>]{<text>}`.
+ The external link is created by `\_pdfstartlink...\pdfendlink` primitives.
+ The <url> is detokenized with `\escapechar=-1` before it is used, so
+ `\%`, `\#` etc. can be used in the <url>.
+ \_cod ----------------------------
\_protected\_def\_urlactive[#1:#2]#3#4{\_leavevmode{\_escapechar=-1
\_pdfstartlink height.9em depth.3em \_pdfborder{#1}%
@@ -35,7 +62,15 @@
\_def\_urlcolor{}
\_public \ulink ;
-%> \_pdfborder
+ \_doc ----------------------------
+ The `\_pdfstartlink` primitive uses `\_pdfborder{<type>}` in its parameter
+ (see `\_linkactive` or `\_urlactive` macros). The `\_pdfbordef{<type>}`
+ expands to `attr{/C[? ? ?] /Border[0 0 .6]}` if the
+ `\<type>border` is defined. User can define it in
+ order to create colored frames around active links. For example
+ `\def\tocborder{1 0 0}` causes red frames in TOC (not printed, only visible
+ in PDF viewers).
+ \_cod ----------------------------
\_def\_pdfborder#1{\_if^#1^\_else \_isdefined{#1border}\_iftrue
\_if^\_csname#1border\_endcsname^\_else
@@ -43,7 +78,11 @@
\_else attr{/Border[0 0 0]}\_fi\_fi
}
-%> \hyperlinks
+ \_doc ----------------------------
+ `\hyperlinks{<ilink_color>}{<ulink_color>}` activates `\dest`, `\link`,
+ `\ilink`, `\ulink` in order they create links. These macros are redefined
+ here to their \"active" version.
+ \_cod ----------------------------
\_def\_hyperlinks#1#2{%
\_let\_dest=\_destactive \_let\_link=\_linkactive
@@ -53,7 +92,15 @@
}
\_public \hyperlinks ;
-%> \url
+ \_doc ----------------------------
+ `\url{<url>}` does approximately the same as `\ulink[<url>]{<url>}`, but
+ more work is done before the `\ulink` is processed. The link-version of <url>
+ is saved to `\_tmpa` and the printed version in `\_tmpb`. The printed
+ version is modified in order to set a breakpoints in special places of the
+ <url>. For example `//` is replaced by `\_urlskip/\_urlskip/\_urlbskip`
+ where `\urlskip` adds a small nobreakable glue between these two slashes and
+ before them and `\_urlbskip` adds a breakable glue after them.
+ \_cod \_fin ----------------------
\_def\_url#1{{%
\_def\_tmpa{#1}\_replstring\_tmpa {\|}{}%
@@ -76,62 +123,29 @@
\_public \url ;
-\_endcode % -------------------------------------
-
-\%> \dest
-
-`\dest[<type>:<label>]` creates a destination of internal links. The
-destination is declared by `<type>:<label>`. If `\hyperlinks` are not
-declared, then `\dest` does nothing else it is set to `\_destactive`.
-The `\_destactive` is implemented by `\_pdfdest` primitive. It creates a box
-in which the destination is shifted by `\_destheight`. The reason is that
-the destination is exactly at top border of the PDF viewer but we want to se
-the line where destination is. The destination box is positioned by
-different way dependent on current vertical or horizontal mode.
-
-\%> \_link \ilink
-
-`\_link[<type>:<label>]{<color>}{<text>}` creates an internal link to `\dest`
-with the same `<type>:<label>`. You can have more links with the same
-`<type>:<label>` but only one `\dest` in the document. If `\hyperlinks` are
-not declared, then `\link` only prints <text> else it is set to `\_linkactive`.
-The `\_linktactive` is implemented by `\_pdfstartlink...\_pdfendlink`
-primitives.
-
-`\ilink[<type>:<label>]{<text>}` is equivalent to `\_link` but <color> is
-used from `\hyperlinks` decaration.
-
-\%> \ulink
-
-`\ulink[<url>]{<text>}` creates external link. It only <text> by default but
-the `\hyperlinks` declaration defines it as `\_urlactive[url:<url>]{<text>}`.
-The external link is created by `\_pdfstartlink...\pdfendlink` primitives.
-The <url> is detokenized with `\escapechar=-1` before it is used, so
-`\%`, `\#` etc. can be used in the <url>.
-
-\%> \_pdfborder
+\_endcode % ----------------------------------------
-The `\_pdfstartink` primitive uses `\_pdfborder{<type>}` in its parameter
-(see `\_linkactive` or `\_urlactive` macros). The `\_pdfbordef{<type>}`
-expands to `attr{/C[? ? ?] /Border[0 0 .6]} if the
-`\<type>border` is defined. User can define it in
-order to create colored frames around active links. For example
-`\def\tocborder{1 0 0}` causes red frames in TOC (not printed, only visible
-in PDF viewers).
-\%> \hyperlinks
+There are four types of the internal links and one type of external link:
-`\hyperlinks{<ilink_color>}{<ulink_color>}` activates `\dest`, `\link`,
-`\ilink`, `\ulink` in order they create links. These macros are redefined
-here to their \"active" version.
+\begitems
+* `ref:<label>` -- the destination is created when `\label[<label>]` is used,
+ see also the section \ref[references].
+* `toc:<tocrefnum>` -- the destination is created at chap/sec/secc titles,
+ see also the section \ref[maketoc].
+* `pg:<gpageno>` -- the destination is created at beginning of each page,
+ see also the section \ref[output].
+* `cite:<bibnum>` -- the destination is created in bibliography reference,
+ see also the section \ref[bib].
+* `url:<url>` -- used by `\url` or `\ulink`,
+ see also the end of this section.
+\enditems
-\%> \url
+The <tocrefnum>, <gpageno> and <bibnum> are numbers starting from one and
+globally incremented by one in whole document. The registers `\_tocrefnum`,
+`\_gpageno` and `\_bibnum` are used for these numbers.
-`\url{<url>}` does approximately the same as `\ulink[<url>]{<url>}`, but
-more work is done before the `\ulink` is processed. The link-version of <url>
-is saved to `\_tmpa` and the printed version in `\_tmpb`. The printed
-version is modified in order to set a breakpoints in special places of the
-<url>. For example `//` is replaced by `\_urlskip/\_urlskip/\_urlbskip`
-where `\urlskip` adds a small nobreakable glue between these two slashes and
-before them and `\_urlbskip` adds a breakable glue after them.
+When a chap/sec/secc title is prefixed by `\label[<label>]`, then both types
+of internal links are created at the same destination place:
+`toc:<tocrefnum>` and `ref:<label>`.
diff --git a/Master/texmf-dist/tex/luatex/optex/hyphen-lan.opm b/Master/texmf-dist/tex/luatex/optex/hyphen-lan.opm
index 86df5cdc46e..0dbdf181fb6 100644
--- a/Master/texmf-dist/tex/luatex/optex/hyphen-lan.opm
+++ b/Master/texmf-dist/tex/luatex/optex/hyphen-lan.opm
@@ -2,27 +2,71 @@
\_codedecl \langlist {Initialization of hypenation patterns <2019-05-21>}
+ \_doc -----------------------------
+ The <iso-code> means a shortcut of language name (mostly by ISO 639-1).
+ The following control sequences are used for language swithing:
+ \begitems
+ * `\_lan:<number>` expands to <iso-code> of the language.
+ The number is internal number of languages used as a value of
+ `\language` register.
+ * `\_ulan:<long-lang>` expands to <iso-code> too. This is transormation
+ from long name of language (lowercase letters) to <iso-code>.
+ * `\_<iso-code>Patt` is the language <number> declared by `\chardef`.
+ * `\_<iso-code>lang` is language selector. It exists in two states
+ \begitems
+ * Initialization state: when `\_<iso-code>lang` is used first then it
+ must load the patterns into memory using Lua code. If it is done then
+ the `\_<iso-code>lang` re-defines itself to processing state.
+ * Processing state: it only sets `\language=\_<iso-code>Patt`, i.e it
+ selects the hyphenation patterns. It does a little more
+ language-dependent work, as mentioned below.
+ \enditems
+ * `\_langspecific:<isocode>` is processed by `\_<iso-code>lang` and it
+ should include language-specific macros declared by user or macro designer.
+ \enditems
+ The USenglish patters are preloaded first:
+ \_cod -----------------------------
+
\_chardef\_enPatt=0
\_def\_pattlist{\_enPatt=0}
\_def\_langlist{en(USenglish)}
\_sdef{_lan:0}{en}
\_sdef{_ulan:usenglish}{en}
\_def\enlang{\_uselang{en}\_enPatt23} % \lefthyph=2 \righthyph=3
-\_sdef{langspecific:en}{\_nonfrenchspacing}
+\_sdef{_langspecific:en}{\_nonfrenchspacing}
\_lefthyphenmin=2 \_righthyphenmin=3 % disallow x- or -xx breaks
\_input hyphen % en(USenglish) patterns from TeX82
+ \_doc -----------------------------
+ `\preplang <iso-code> <long-lang> <number-cs> <number> <pre-hyph><post-hyph>
+ prepares the `\_<iso-code>lang` to its initialization state. Rougly
+ speaking, it does:
+ \begtt
+ \chardef\_<iso-code>Patt = <number>
+ \def\_lan:<number> {<iso-code>}
+ \def\_ulan:<long-lang> {<iso-code>}
+ \def\_<iso-code>lang {%
+ \_loadpattrs <long-lang> <number> % loads patterns using Lua code
+ \gdef\_<iso-code>lang {\_uselang{<iso-code>}\_<iso-code>Patt <pre-hyph><post-hyph>}
+ \_<iso-code>lang % runs itself in processing state
+ }
+ \def\<iso-code>lang {\_<iso-code>lang} % public version \<iso-code>lang
+ \endtt
+ You can see that `\_<iso-code>lang` runs `\_uselang` in processing state.
+ \_cod -----------------------------
+
\_def\_preplang #1 #2 #3#4 #5 {%
\_chardef#3=#4
\_sdef{_lan:#4}{#1}\_lowercase{\_sdef{_ulan:#2}}{#1}%
- \_def\_next{\_expandafter\_noexpand\_csname #1lang\_endcsname}
- \_ea\_edef \_csname #1lang\_endcsname {%
- \_lowercase{\_noexpand\_loadpattrs #2} #4
- \_gdef\_next{\_noexpand\_uselang{#1}#3#5}%
- \_next
+ \_def\_next{\_ea\_noexpand\_csname _#1lang\_endcsname}
+ \_ea\_edef \_csname _#1lang\_endcsname {%
+ \_lowercase{\_noexpand\_loadpattrs #2} #4 % loads patterns
+ \_gdef\_next{\_noexpand\_uselang{#1}#3#5}% re-defines itself
+ \_next % runs itself in processing state
}
\_addto\_langlist{ #1(#2)}%
+ \_sdef{#1lang}{\_csname _#1lang\_endcsname}% unprefixed \<isocode>lang
}
\_def\_loadpattrs#1 #2 {%
\_directlua{
@@ -30,11 +74,33 @@
luatexhyphen.loadlanguage("#1",#2)
}%
}
+
+ \_doc -----------------------------
+ `\_uselang{<iso-code>}\_<iso-code>Patt <pre-hyph><post-hyph>`
+ sets `\language`, `\lefthyphenmin`, `\righthyphenmin` and runs
+ `\frenchspacing`. This default language-dependent settings
+ should be re-declared by `\_langspecific:<iso-code>` which is run
+ finally (it is `\relax` by default, only `\_langspecific:en` runs
+ `\nonfrenchspacing`).
+ \_cod -----------------------------
+
\_def\_uselang#1#2#3#4{\_language=#2\_lefthyphenmin=#3\_righthyphenmin=#4\_relax
- \_frenchspacing % \nonfrenchspacing can be set in \cs{langspecific:lan}
- \_cs{langspecific:#1}%
+ \_frenchspacing % \nonfrenchspacing can be set in \cs{_langspecific:lan}
+ \_cs{_langspecific:#1}%
}
-\_def\_uselanguage#1{\_lowercase{\_cs{\_cs{_ulan:#1}lang}}}
+ \_doc -----------------------------
+ The `\_uselanguage` is defined here (for compatibility with e-plain users).
+ \_cod -----------------------------
+
+\_def\_uselanguage#1{\_lowercase{\_cs{_\_cs{_ulan:#1}lang}}}
+
+ \_doc -----------------------------
+ The numbers for languages are declared as fixed contants (no
+ auto-generated). This concept is inspired from CSplain.
+ There are typical numbers of languages in CSplain: 5=Czech in IL2,
+ 15=Czech in T1 nad 115=Czech in Unicode. We keep these constants
+ but we load only Unicode patterns (greater than 100), of course.
+ \_cod -----------------------------
\_preplang enus USenglishmax \_enusPatt 100 23
\_preplang engb UKenglish \_engbPatt 101 23
@@ -95,6 +161,13 @@
\_preplang ta Tamil \_taPatt 221 11
\_preplang te Telugu \_tePatt 222 11
+ \_doc -----------------------------
+ The `\_langlist` includes names of all languages which are ready to load
+ and use their hyphenation patterns. This list is printed to terminal and
+ to log at ini\TeX/ state here. User can print `\_langlist` in the
+ document too.
+ \_cod -----------------------------
+
\message{Language hyph.patterns ready to load: \_langlist.
Use \string\<shortname>lang to initialize language,
\string\cslang\space for example}
@@ -105,3 +178,22 @@
\_endcode % ---------------------------------------------
+Maybe, you need to do more language specific actions than only to swich
+hyphenation patterns. For example you need to load a specific font with a
+specific script used in selected language, you can define a macros for
+quotation marks depending on the language etc.
+
+The example shows how to declare such language specific things.
+
+\begtt
+\def\langset #1 #2{\sdef{_langspecific:#1}{#2}}
+
+\langset fr {... declare French quotation marks}
+\langset de {... declare German quotation marks}
+\langset gr {... switch to Greek fonts family}
+... etc.
+\endtt
+
+Note that you need not to set language specific words (like `\today`)
+by this code. Another concept is used for such tasks. See `languages.opm`
+for more details.
diff --git a/Master/texmf-dist/tex/luatex/optex/if-macros.opm b/Master/texmf-dist/tex/luatex/optex/if-macros.opm
index ea2f84ee41d..d0423e5911e 100644
--- a/Master/texmf-dist/tex/luatex/optex/if-macros.opm
+++ b/Master/texmf-dist/tex/luatex/optex/if-macros.opm
@@ -2,7 +2,15 @@
\_codedecl \newif {Special if-macros, is-macros and loops <2020-01-23>}
-%> \newif
+ \_doc ----------------------------
+ The `\newif` macro works like in plain \TeX. It means that
+ after `\newif\ifxxx` you can use `\xxxtrue` or
+ `\xxxfalse` to set the boolean value and use `\ifxxx true\else false\fi`
+ to test this value. The defalut value is false.
+
+ The macro `\_newifi` enables to declare `\_ifxxx` and to use `\_xxxtrue` and
+ `\_xxxfalse`. This means that it is usable for _prefixed macros.
+ \_cod ----------------------------
\_def\_newif #1{\_ea\_newifA \_string #1\_relax#1}
\_ea\_def \_ea\_newifA \_string\if #1\_relax#2{%
@@ -17,7 +25,15 @@
\_let#2=\_iffalse
}
-%> \loop
+ \_doc ----------------------------
+ The `\loop <codeA> \ifsomething <codeB> \repeat` loops `<codeA> <codeB>`
+ until `\ifsomething` is false. Then `<codeB>` is not executed and loop is
+ finished. This works like in plain \TeX, but implementation is soewhat
+ better (you can use `\else` clause after the `\ifsomething`).
+
+ There are public version `\loop...\repeat` and private version
+ `\_loop...\_repeat`. You canot mix both versions in one loop.
+ \_cod ----------------------------
\_def \_loop #1\_repeat{\_def\_body{#1}\_iterate}
\_def \loop #1\repeat{\_def\_body{#1}\_iterate}
@@ -25,14 +41,31 @@
\_let \repeat=\_fi
\_def \_iterate {\_body \_ea \_iterate \_fi}
-%> \isnextchar <char>{exec if true}{exec if false}
+ \_doc ----------------------------
+ The macro `\isnextchar <char>{<codeA>}{<codeB>}` executes `<codeA>` if next
+ character is equal to <char>. Else the `<codeB>` is executed. The macro is
+ not expandable.
+ \_cod ----------------------------
\_long\_def\_isnextchar#1#2#3{\_begingroup\_toks0={\_endgroup#2}\_toks1={\_endgroup#3}%
\_let\_tmp=#1\_futurelet\_next\_isnextcharA
}
\_def\_isnextcharA{\_the\_toks\_ifx\_tmp\_next0\_else1\_fi\_space}
-%> \isempty{text}\iftrue, \isempty{text}\iffalse:
+ \_doc ----------------------------
+ The macro `\isempty{<text>}\iftrue <codeA>\else <codeB>\fi` executes <codeA>
+ if <text> is empty and <codeB> if it is non-empty. You can use
+ `\isempty{<text>}\iffalse <codeB>\else <codeA>\fi` too. This macro is
+ expandable.
+
+ There are a collection of macros with commnon syntax:
+ `\issomething<params>\iftrue` or `\issomething<params>\iffalse`.
+ The `\iftrue` or `\iffalse` is a part of this syntax because we need to keep
+ skippable nested `\if` conditions.
+
+ We read this `\iftrue` or `\iffalse` into unseparated parameter and repeat
+ it because we need to remove an optional space before this command.
+ \_cod ----------------------------
\_def \_isempty #1#2{\_ea\_ifx\_ea\_relax\_detokenize{#1}\_relax
\_else \_ea\_unless \_fi #2}
@@ -40,28 +73,44 @@
\_ea\_unless \_fi #2}
\_def \_istoksempty #1{\_ea\_isempty\_ea{\_the#1}}
-%> \isequal{text}{text}\iftrue ...
+ \_doc ----------------------------
+ `\isequal{<textA>}{<textB>}\iftrue` is true if the <textA> and <textB> are
+ equal, only from strings point of view, category codes are ignored.
+ The macro is expandable.
+ \_cod ----------------------------
\_def\_isequal#1#2#3{\_directlua{%
if "\_luaescapestring{\_detokenize{#1}}"=="\_luaescapestring{\_detokenize{#2}}"
then else tex.print("\_nbb unless") end}#3}
-%> \ismacro\macro{text}\iftrue ...
+ \_doc ----------------------------
+ `\ismacro\macro{text}\iftrue` is true if macro is defined as {<text>}.
+ Category codes are ignored in this testing. The macro is expandable.
+ \_cod ----------------------------
\_def\_ismacro#1{\_ea\_isequal\_ea{#1}}
-%> \isdefined{csname}\iftrue
+ \_doc ----------------------------
+ `\isinlist\list{<text>}\iftrue` is true if the
+ `<text>` is included the macro body of the `\list`.
+ The catogory code are relevant here. THe macro is not expandable.
+ \_cod ----------------------------
\_def\_isdefined #1#2{\_ifcsname #1\_endcsname \_else \_ea\_unless \_fi #2}
-%> \isinlist\list{text}\iftrue ...
+ \_doc ----------------------------
+ `\isdefined{<csname>}\iftrue` is true if `\<csname>` is defined.
+ \_cod ----------------------------
\_long\_def\_isinlist#1#2{\_begingroup
\_long\_def\_tmp##1#2##2\_end/_{\_endgroup\_isnoempty{##2}}%
\_ea\_tmp#1\_endlistsep#2\_end/_%
}
-%> \isfile{name}\iftrue ...
+ \_doc ----------------------------
+ `\isfile{<filename>}\iftrue` is true if the file <filename> exists and are
+ readable by \TeX.
+ \_cod \_fin ----------------------
\_newread \_testin
@@ -75,72 +124,5 @@
\_public
\newif \isnextchar \isempty \isequal \ismacro \isdefined \isinlist \isfile ;
-\_endcode %---------------------------------------------------------
-
-\%> \newif
-
-The `\newif` macro works like in plain \TeX. It means that
-after `\newif\ifxxx` you can use `\xxxtrue` or
-`\xxxfalse` to set the boolean value and use `\ifxxx true\else false\fi`
-to test this value. The defalut value is false.
-
-The macro `\_newifi` enables to declare `\_ifxxx` and to use `\_xxxtrue` and
-`\_xxxfalse`. This means that it is usable for _prefixed macros.
-
-\%> \loop
-
-The `\loop <codeA> \ifsomething <codeB> \repeat` loops `<codeA> <codeB>`
-until `\ifsomething` is false. Then `<codeB>` is not executed and loop is
-finished. This works like in plain \TeX, but implementation is soewhat
-better (you can use `\else` clause after the `\ifsomething`).
-
-There are public version `\loop...\repeat` and private version
-`\_loop...\_repeat`. You canot mix both versions in one loop.
-
-\%> \isnextchar
-
-The macro `\isnextchar <char>{<codeA>}{<codeB>}` executes `<codeA>` if next
-character is equal to <char>. Else the `<codeB>` is executed. The macro is
-not expandable.
-
-\%> \isempty
-
-The macro `\isempty{<text>}\iftrue <codeA>\else <codeB>\fi` executes <codeA>
-if <text> is empty and <codeB> if it is non-empty. You can use
-`\isempty{<text>}\iffalse <codeB>\else <codeA>\fi` too. This macro is
-expandable.
-
-There are a collection of macros with commnon syntax:
-`\issomething<params>\iftrue` or `\issomething<params>\iffalse`.
-The `\iftrue` or `\iffalse` is a part of this syntax because we need to keep
-skippable nested `\if` conditions.
-
-We read this `\iftrue` or `\iffalse` into unseparated parameter and repeat
-it because we need to remove an optional space before this command.
-
-\%> \isequal
-
-`\isequal{<textA>}{<textB>}\iftrue` is true if the <textA> and <textB> are
-equal, only from strings point of view, category codes are ignored.
-The macro is expandable.
-
-\%> \ismacro
-
-`\ismacro\macro{text}\iftrue` is true if macro is defined as {<text>}.
-Category codes are ignored in this testing. The macro is expandable.
-
-\%> \isdefined
-
-`\isdefined{<csname>}\iftrue` is true if `\<csname>` is defined.
-
-\%> \isinlist
-
-`\isinlist\list{<text>}\iftrue` is true if the
-`<text>` is included the macro body of the `\list`.
-The catogory code are relevant here. THe macro is not expandable.
-
-\%> \isfile
-
-`\isfile{<filename>}\iftrue` is true if the file <filename> exists and are
-readable by \TeX.
+\_endcode
diff --git a/Master/texmf-dist/tex/luatex/optex/languages.opm b/Master/texmf-dist/tex/luatex/optex/languages.opm
new file mode 100644
index 00000000000..b4d6f57d2af
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/languages.opm
@@ -0,0 +1,75 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \_mtext {Languages <2020-02-14>}
+
+ \_doc -----------------------------
+ Only three words are generated by \OpTeX/ macros: \"Chapter",
+ \"Table", \"Figure" and \"Subject". These words can be generated depending
+ on the current value of `\language` register, if you use `\_mtext{chap}`,
+ `\_mtext{t}` or `\_mtext{f}`. If your macros generate more words then
+ you can define such words by `\sdef{_mt:<label>:<lang>}` where
+ <label> is a label for declared word and <lang> is language shortcut.
+ \_cod -----------------------------
+
+\def\_mtext#1{\_trycs{_mt:#1:\_trycs{_lan:\_the\_language}{en}}
+ {\_csname _mt:#1:en\_endcsname}}
+
+\sdef{_mt:chap:en}{Chapter} \sdef{_mt:chap:cs}{Kapitola} \sdef{_mt:chap:sk}{Kapitola}
+\sdef{_mt:t:en}{Table} \sdef{_mt:t:cs}{Tabulka} \sdef{_mt:t:sk}{Tabuľka}
+\sdef{_mt:f:en}{Figure} \sdef{_mt:f:cs}{Obrázek} \sdef{_mt:f:sk}{Obrázok}
+\sdef{_mt:subj:en}{Subject} \sdef{_mt:subj:cs}{Věc} \sdef{_mt:subj:sk}{Vec}
+
+ \_doc -----------------------------
+ Using `\_langw <lang> <chapter> <table> <figure> <subject>` you can
+ declare these words more efectively.
+ \_cod -----------------------------
+
+\_def \_langw #1 #2 #3 #4 #5 {%
+ \_sdef{_mt:chap:#1}{#2}\_sdef{_mt:t:#1}{#3}\_sdef{_mt:f:#1}{#4}%
+ \_sdef{_mt:subj:#1}{#5}%
+}
+
+\_langw en Chapter Table Figure Subject
+%--------------------------------------------------------------
+\_langw cs Kapitola Tabulka Obrázek Věc
+\_langw de Kapitel Tabelle Obrázek Subjekt
+\_langw es Capítulo Tabla Figura Sujeto
+\_langw fr Chaptire Tableau Figure Matière
+\_langw gr Κεφάλαιο Πίνακας Σχήμα θέμα
+\_langw it Capitolo Tabella Fig. Soggetto
+\_langw pl Rozdział Tabela Ilustracja Temat
+\_langw ru Глава Таблица Рисунок Предмет
+\_langw sk Kapitola Tabuľka Obrázok Vec
+
+ \_doc -----------------------------
+ You can add more words as you wish. For eample `\today` macro:
+ \_cod -----------------------------
+
+\_def \_monthw #1 #2 #3 #4 #5 #6 #7 {%
+ \_sdef{_mt:m1:#1}{#2}\_sdef{_mt:m2:#1}{#3}\_sdef{_mt:m3:#1}{#4}%
+ \_sdef{_mt:m4:#1}{#5}\_sdef{_mt:m5:#1}{#5}\_sdef{_mt:m6:#1}{#5}%
+ \_monthwB #1
+}
+\_def \_monthwB #1 #2 #3 #4 #5 #6 #7 {%
+ \_sdef{_mt:m7:#1}{#2}\_sdef{_mt:m8:#1}{#3}\_sdef{_mt:m9:#1}{#4}%
+ \_sdef{_mt:m10:#1}{#5}\_sdef{_mt:m11:#1}{#5}\_sdef{_mt:m12:#1}{#5}%
+}
+
+\_monthw en January February March April May June
+ July August September October November December
+\_monthw cs ledna února března dubna května června
+ července srpna září října listopadu prosince
+\_monthw sk januára februára marca apríla mája júna
+ júla augusta septembra októbra novembra decembra
+
+\_sdef{_mt:today:en}{\_mtext{m\the\month} \the\day, \the\year}
+\_sdef{_mt:today:cs}{\the\day.~\_mtext{m\the\month} \the\year}
+\_slet{_mt:today:sk}{_mt:today:cs}
+
+\_def\_today{\_mtext{today}}
+\_public \today ;
+
+
+\_endcode % -------------------------------------
+
+
diff --git a/Master/texmf-dist/tex/luatex/optex/lists.opm b/Master/texmf-dist/tex/luatex/optex/lists.opm
new file mode 100644
index 00000000000..0b63409dce7
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/lists.opm
@@ -0,0 +1,79 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \begitems {Lists: begitems, enditems <2020-03-14>}
+
+ \_doc -----------------------------
+ `\aboveliskip` is used above the list of items,
+ `\belowliskip` is used below the list of items and
+ `\interliskip` is used between items.
+ \_cod -----------------------------
+
+\_def\_aboveliskip {\_removelastskip \_penalty-100 \_medskip}
+\_def\_belowliskip {\_penalty-200 \_medskip}
+\_def\_interliskip {}
+
+ \_doc -----------------------------
+ The `\itemnum` is localy reset to zero in each group declared by
+ `\begitems`. So nested lists are numbered independently. User can set
+ initial value of `\itemnum` to another value after `\beitems` if he/she want.
+
+ Each level of nested lists is indented by new `\iindent` from left.
+ Default item mark is `\_printitem`.
+
+ The `\begitems` runs `\_aboveliskip` only if we are not near below a title,
+ where a vertical skip is placed already and where the `\penalty` 11333 is.
+ \_cod -----------------------------
+
+\_newcount\_itemnum \_itemnum=0
+\_newtoks\_printitem
+
+\_def\_begitems{\_par \_ifnum\_lastpenalty<10000 \_aboveliskip \_fi
+ \_bgroup
+ \_itemnum=0 \_adef*{\_startitem}
+ \_advance\_leftskip by\_iindent
+ \_printitem=\_defaultitem
+}
+\_def\_enditems{\_par\_egroup\_belowliskip}
+
+\_def\_startitem{\_par \_ifnum\_itemnum>0 \_interliskip \_fi
+ \_advance\_itemnum by1
+ \_the\_everyitem \_noindent\_llap{\_the\_printitem}\_ignorespaces
+}
+
+ \_doc -----------------------------
+ Various item marks are saved in `\_item:<letter>` macros.
+ You ca re-define then or define more such macros.
+ The `\style <letter>` does `\_printitem={\_item:<letter>}`.
+ \_cod -----------------------------
+
+\_def\_style#1{%
+ \_ifcsname _item:#1\_endcsname \_printitem=\ea{\_csname _item:#1\_endcsname}%
+ \_else \_printitem=\_defaultitem \_fi
+}
+\_sdef{_item:o}{\_raise.4ex\_hbox{$\_scriptscriptstyle\_bullet$} }
+\_sdef{_item:-}{- }
+\_sdef{_item:n}{\_the\_itemnum. }
+\_sdef{_item:N}{\_the\_itemnum) }
+\_sdef{_item:i}{(\_romannumeral\_itemnum) }
+\_sdef{_item:I}{\_uppercase\_ea{\_romannumeral\_itemnum}\_kern.5em}
+\_sdef{_item:a}{\_athe\_itemnum) }
+\_sdef{_item:A}{\_uppercase\_ea{\_athe\_itemnum}) }
+\_sdef{_item:x}{\_raise.3ex\_fullrectangle{.6ex} }
+\_sdef{_item:X}{\_raise.2ex\_fullrectangle{1ex}\_kern.5em}
+
+ \_doc -----------------------------
+ `\_athe{<num>}` returns the <num>s lowercase letter from the alphabet.
+ `\_fullrectangle{<dimen>}` prints full rectangle with given <dimen>.
+ \_cod -----------------------------
+
+\_def\_fullrectangle#1{\_hbox{\_vrule height#1 width#1}}
+
+\_def\_athe#1{\_ifcase#1?\_or a\_or b\_or c\_or d\_or e\_or f\_or g\_or h\_or
+ i\_or j\_or k\_or l\_or m\_or n\_or o\_or p\_or q\_or r\_or s\_or t\_or
+ u\_or v\_or w\_or x\_or y\_or z\_else ?\_fi
+}
+\_public \begitems \enditems \style \itemnum ;
+
+\_endcode % -------------------------------------
+
+
diff --git a/Master/texmf-dist/tex/luatex/optex/logos.opm b/Master/texmf-dist/tex/luatex/optex/logos.opm
index f691aa0b61c..4465d56e9b4 100644
--- a/Master/texmf-dist/tex/luatex/optex/logos.opm
+++ b/Master/texmf-dist/tex/luatex/optex/logos.opm
@@ -2,20 +2,31 @@
\_codedecl \TeX {Logos TeX, LuaTeX, etc. <2019-05-21>}
+ \_doc ----------------------------
+ Despite plain \TeX/ each macro for logos ends by `\ignoreslash`.
+ This macro ignores next slash if it is present.
+ You can `use \TeX/ like this` for protecting the space following the logo.
+ This is visually more comfortable.
+ \_cod ----------------------------
+
\_protected\_def \_TeX {T\_kern-.1667em\_lower.5ex\_hbox{E}\_kern-.125emX\_ignoreslash}
\_protected\_def \_OpTeX {Op\kern-.1em\_TeX}
\_protected\_def \_LuaTeX {Lua\_TeX}
\_protected\_def \_XeTeX {X\_kern-.125em\_phantom E%
\_pdfsave\_rlap{\_pdfscale{-1}{1}\_lower.5ex\_hbox{E}}\_pdfrestore \_kern-.1667em \_TeX}
-\_def\_LaTeX{\_tmpdim=.42ex L\_kern-.36em \_kern \_slantcorr % slant correction
+
+ \_doc------------------------------
+ The `\_slantcorr` macro expands to slant-correction of current font. It is
+ used to shifting A if `\LaTeX` is in itallic.
+ \_cod -----------------------------
+
+\_protected\_def \_LaTeX{\_tmpdim=.42ex L\_kern-.36em \_kern \_slantcorr % slant correction
\_raise \_tmpdim \_hbox{\_thefontscale[710]A}%
\_kern-.15em \_kern-\_slantcorr \_TeX}
-\_def\_slantcorr{\_ea\_ignorept \_the\_fontdimen1\_the\_font\_tmpdim}
+\_def\_slantcorr{\_ea\_ignorept \_the\_fontdimen1\_font\_tmpdim}
\_def\_ignoreslash {\_futurelet\_next \_ignoreslashA}
\_def\_ignoreslashA {\_ifx\_next/\_ea\_ignoreit\_fi}
-\_def\_ignoreit#1{}
-{\_lccode`\?=`\p \_lccode`\!=`\t \_lowercase{\_gdef\_ignorept#1?!{#1}}}
\_def\_OPmac{\_leavevmode
\_lower.2ex\_hbox{\_thefontscale[1400]O}\_kern-.86em P{\_em mac}\_ignoreslash}
@@ -23,26 +34,20 @@
\_def\_csplain{\_CS plain\_ignoreslash}
\_def\_ignslash#1{\_ifx/#1\_else #1\_fi}
-\_toksapp \_pdfstringout {% conversion for PDF outlines
+ \_doc ----------------------------
+ The expandable versions of logos used in Outlines needs the expandablle
+ `\_ingnslash` (instead of `\_ignoreslash`).
+ \_cod \_fin ----------------------
+
+\_regmacro {}{}{% conversion for PDF outlines
\_def\TeX{TeX\_ignslash}\_def\OpTeX{OpTeX\_ignslash}%
\_def\LuaTeX{LuaTeX\_ignslash}\_def\XeTeX{XeTeX\_ignslash}%
\_def\LaTeX{LaTeX\_ignslash}\_def\OPmac{OPmac\_ignslash}%
\_def\CS{CS}\_def\csplain{csplain\_ignslash}%
}
-
\_public
\TeX \OpTeX \LuaTeX \XeTeX \LaTeX \OPmac \CS \csplain
\ignoreslash \ignoreit \ignorept ;
\_endcode
-We define common logos used in \TeX. Despite plain \TeX/ each such macro
-ends by `\ignoreslash`. This macro ignores next slash if it is present.
-You can `use \TeX/ like this` for protecting the space following the logo.
-
-The `\ignoreit` macro ignores next token. The \ignorept macro used ike this:
-\begtt
-\ea\ignorept \the\dimen...
-\endtt
-consumes the "pt" phrase appended to dimen value by `\the`.
-
diff --git a/Master/texmf-dist/tex/luatex/optex/makeindex.opm b/Master/texmf-dist/tex/luatex/optex/makeindex.opm
new file mode 100644
index 00000000000..eae300dfba1
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/makeindex.opm
@@ -0,0 +1,431 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \makeindex {Makeindex and sorting <2020-02-14>} % loaded in format
+
+ \_doc -----------------------------
+ `\makeindex` implements sorting algorithm at \TeX/ macrolanguage level.
+ You need not any external program.
+
+ There are two passes in sorting algorith. Primary pass does not
+ distinguish between a group o letters (typically non-accented and
+ accented). If the result of comparing two string is equal in primary pass
+ then secondary pass is started. It distinguish betveen variously accented
+ letters. Czech rules, for example says: not accented before dieresis
+ before acute before circumflrex before ring. At less priority: lowercase
+ letters maut be before uppercase letters.
+
+ The `\_sortingdata<iso-code>` implements these rules for the language
+ <iso-code>. The groups between commas are not distinguished in the first
+ pass. The second pass distinguishes all characters mentioned in the
+ `\_sortingdata<iso-code>` (commas are ignored). The order of letters
+ in the `\_sortingdata<iso-code>` macro is significant for sorting algorithm.
+ The Czech rules are implemented here:
+ \_cod -----------------------------
+
+\_def \_sortingdatacs {%
+ /,{ },-,&,@,%
+ aAäÄáÁ,%
+ bB,%
+ cC,%
+ čČ,%
+ dDďĎ,%
+ eEéÉěĚ,%
+ fF,%
+ gG,%
+ hH,%
+ ^^T^^U^^V,% ch Ch CH
+ iIíÍ,%
+ jJ,%
+ kK,%
+ lLĺĹľĽ,%
+ mM,%
+ nNňŇ,%
+ oOöÖóÓôÔ,%
+ pP,%
+ qQ,%
+ rRŕŔ,%
+ řŘ,%
+ sS,%
+ šŠ,%
+ tTťŤ,%
+ uUüÜúÚůŮ,%
+ vV,%
+ wW,%
+ xX,%
+ yYýÝ,%
+ zZ,%
+ žŽ,%
+ 0,1,2,3,4,5,6,7,8,9,'%
+}
+
+ \_doc -----------------------------
+ Characters ignored by sorting algorithm are declared in `\_ignoredchars<iso-code>`.
+ The compound characters (two or more characters interpreted as one
+ character in sorting algorithm) is mapped to single invisible characters
+ in `\_compoundchars<iso-code>`. Czech rules declares ch or Ch or CH as
+ a single letter sorted between H and I. See `\_sortingdatacs` above where
+ these declared characters are used.
+
+ The characters declared in `\_ignoredchars` are ignored in first pass
+ without additional condidion. They are ignored in second pass only if
+ they are not mentioned in the `\_sortingdata<iso-code>` macro.
+ \_cod -----------------------------
+
+\_def \_ignoredcharscs {.,;?!:'"|()[]<>=+}
+\_def \_compoundcharscs {ch:^^T Ch:^^U CH:^^V} % DZ etc. are sorted normally
+
+ \_doc -----------------------------
+ Slovak sorting rules are the same as Czech. The macro `\_sortingdatacs`
+ includes Slovak letters too. Compound characters are the same.
+ English sorting rules can be defined by `\_sortingdatacs` too because
+ English alphabet is subset of Czech and Slovak alphabets. Only
+ difference: `\_compoundcharsen` is empty in English rules.
+
+ You can declare these macros for more languages, if you wish to use
+ `\makeindex` with sorting rules in respect to your language.
+ Note: if you need to map compound characters to a character, don't use
+ `^^I` or `^^M` because these characters have very specific category code.
+ And use space to separate more mappings, like in `\_compoundcharscs`.
+ \_cod -----------------------------
+
+\_let \_sortingdatask = \_sortingdatacs
+\_let \_compoundcharssk = \_compoundcharscs
+\_let \_ignoredcharssk = \_ignoredcharscs
+\_let \_sortingdataen = \_sortingdatacs
+\_def \_compoundcharsen {}
+\_let \_ignoredcharsen = \_ignoredcharscs
+
+ \_doc -----------------------------
+ Preparing to primary pass is implemented here. It is called from `\makeindex`
+ macro and all processing of sorting is in a group.
+ \_cod -----------------------------
+
+\_def\_setprimarysorting {%
+ \_ea\_let \_ea\_sortingdata \_csname _sortingdata\_sortinglang\endcsname
+ \_ea\_let \_ea\_compoundchars \_csname _compoundchars\_sortinglang\endcsname
+ \_ea\_let \_ea\_ignoredchars \_csname _ignoredchars\_sortinglang\endcsname
+ \_ifx \_sortingdata\_relax \_let \_sortingdata = \_sortingdataen \fi
+ \_ifx \_compoundchars\_relax \_let \_compoundchars = \_compoundcharsen \fi
+ \_ifx \_ignoredchars\_relax \_let \_ignoredchars = \_ignoredcharsen \fi
+ \_ifx \_compoundchars\_empty \_else
+ \_edef \_compoundchars {\_detokenize\_ea{\_compoundchars} }\_fi % all must be catcode 12
+ \_def \_act ##1{\_ifx##1\_relax \_else
+ \_ifx##1,\_advance\_tmpnum by1
+ \_else \_lccode`##1=\_tmpnum \_fi
+ \_ea\_act \_fi}%
+ \_tmpnum=60 \_ea\_act \_sortingdata \_relax
+ \_def \_act ##1{\_ifx##1\_relax \_else
+ \_lccode`##1=`\^^I
+ \_ea\_act \_fi}%
+ \_ea\_act \_ignoredchars \_relax
+}
+
+ \_doc -----------------------------
+ Preparing to secondary pass is implemented here:
+ \_cod -----------------------------
+
+\_def\_setsecondarysorting {%
+ \_def \_act ##1{\_ifx##1\_relax \_else
+ \_ifx##1,\_else \_advance\_tmpnum by1 \_lccode`##1=\_tmpnum \_fi
+ \_ea\_act \_fi}%
+ \_tmpnum=60 \_ea\_act \_sortingdata \_relax
+}
+
+ \_doc -----------------------------
+ Strings to be sorted are prepared in `\,<string>` control sequences
+ (in order to save `\TeX` memory).
+ The `\_preparesortstring \,<string>` converts <string> to `\_tmpb`
+ with respect to the data initialized in `\_setprimarysorting` or
+ `\_setsecondarysortting`.
+ \_cod -----------------------------
+
+\_def \_preparesorting #1{%
+ \_edef \_tmpb {\_ea\_ignorefirst\_csstring #1}% \,<string> -> <string>
+ \_ea \_docompound \_compoundchars \_relax:{} % replace compound characters
+ \_lowercase \_ea{\_ea\_def \_ea\_tmpb \_ea{\_tmpb}}% convert in respect to \_sortingdata
+ \_ea\_replstring \_ea\_tmpb \_ea{\_csstring\^^I}{}% remove ignored characters
+}
+\_def \_docompound #1:#2 {%
+ \_ifx\_relax#1\_else \_replstring\_tmpb {#1}{#2}\_ea\_docompound \_fi
+}
+\_def \_ignorefirst#1{}
+
+ \_doc -----------------------------
+ Macro `\_isAleB \,<string1> \,<string2>` returns the result of comparison
+ of given two strings to `\_ifAleB` control sequence. Usage:
+ `\isAleB \,<string1> \,<string2>` \_ifAleB ... \_else ... \_fi`
+ The converted strings (in respect of the data prepared for first pass)
+ must be saved as valuses of `\,<string1>` and `\,<string2>` macros.
+ The reason is speed: we don't want to convert them repeatedly in each
+ comparison.
+
+ The auxiliary macro
+ `\_testAleB <converted string1>&\_relax<converted-string2>\_relax \,<string1>\,<string2>`
+ does the real work. It reads first character from both converted strings, compares them
+ and if it is equal then calls iself recursively else gives result.
+ \_cod -----------------------------
+
+\_newifi \_ifAleB
+
+\_def\_isAleB #1#2{%
+ \_edef\_tmpb {#1&\_relax#2&\_relax}%
+ \_ea \_testAleB \_tmpb #1#2%
+}
+\_def\_testAleB #1#2\_relax #3#4\_relax #5#6{%
+ \_if #1#3\_if #1&\_testAleBsecondary #5#6% goto to the second pass::
+ \_else \_testAleB #2\_relax #4\_relax #5#6%
+ \_fi
+ \_else \_ifnum `#1<`#3 \_AleBtrue \_else \_AleBfalse \_fi
+ \_fi
+}
+\_def\_testAleBsecondary#1#2{%
+ \_bgroup
+ \_setsecondarysorting
+ \_preparesorting#1\_let\_tmpa=\_tmpb \_preparesorting#2%
+ \_edef\_tmpb{\_tmpa0\_relax\_tmpb1\_relax}%
+ \_ea\_testAleBsecondaryX \_tmpb
+ \_egroup
+}
+\_def\_testAleBsecondaryX #1#2\_relax #3#4\_relax {%
+ \_if #1#3\_testAleBsecondaryX #2\_relax #4\_relax
+ \_else \_ifnum `#1<`#3 \_global\_AleBtrue \_else \_global \_AleBfalse \_fi
+ \_fi
+}
+
+ \_doc -----------------------------
+ Merge sort is very efectively implemented by \TeX/ macros. The following
+ code is created by my son Miroslav.
+ The `\_mergesort` macro expects that all items in `\_iilist` are separated
+ by comma when it starts. It ends with sorted items in `\_iilist` without commas.
+ So `\_dosorting` macro must prepare commas between items.
+ \_cod -----------------------------
+
+\_def\_mergesort #1#2,#3{% by Miroslav Olsak
+ \_ifx,#1% % prazdna-skupina,neco, (#2=neco #3=pokracovani)
+ \_addto\_iilist{#2,}% % dvojice skupin vyresena
+ \_sortreturn{\_fif\_mergesort#3}% % \mergesort pokracovani
+ \_fi
+ \_ifx,#3% % neco,prazna-skupina, (#1#2=neco #3=,)
+ \_addto\_iilist{#1#2,}% % dvojice skupin vyresena
+ \_sortreturn{\_fif\_mergesort}% % \mergesort dalsi
+ \_fi
+ \_ifx\_end#3% % neco,konec (#1#2=neco)
+ \_ifx\_empty\_iilist % neco=kompletni setrideny seznam
+ \_def\_iilist{#1#2}%
+ \_sortreturn{\_fif\_fif\_gobbletoend}% % koncim
+ \_else % neco=posledni skupina nebo \end
+ \_sortreturn{\_fif\_fif % spojim \indexbuffer+necoa cele znova
+ \_edef\_iilist{\_ea}\_ea\_mergesort\_iilist#1#2,#3}%
+ \_fi\_fi % zatriduji: p1+neco1,p2+neco2, (#1#2=p1+neco1 #3=p2)
+ \_isAleB #1#3\_ifAleB % p1<p2
+ \_addto\_iilist{#1}% % p1 do bufferu
+ \_sortreturn{\_fif\_mergesort#2,#3}% % \mergesort neco1,p2+neco2,
+ \_else % p1>p2
+ \_addto\_iilist{#3}% % p2 do bufferu
+ \_sortreturn{\_fif\_mergesort#1#2,}% % \mergesort p1+neco1,neco2,
+ \_fi
+ \_relax % zarazka, na ktere se zastavi \sortreturn
+}
+\_def\_sortreturn#1#2\_fi\_relax{#1} \_def\_fif{\_fi}
+\_def\_gobbletoend #1\_end{}
+
+ \_doc -----------------------------
+ The `\_dosorting \list` macro redefines `\list` as sorted `\list`.
+ The `\list` have to include control sequences in the form `\<c><string>`.
+ These control sequences will be sorted in respect to <strings> wihout
+ change of meanings of these control sequences. Their meanings are
+ irrelevant when sorting. The first character <c> in `\<c><string>` should
+ be whatever. It does not influence the sorting. \OpTeX/ uses comma at
+ this place for sorting indexes: `\,<word1> \,<word2> \,<word3> ...`.
+
+ The actual language is used for sorting data. If the `\_sortinglang` macro
+ is defined as <iso-code> then it has precedence and actual languge is not used.
+ Moreover, if you specify `\_asciisortingtrue` then ASCII sorting will be processed
+ and all language sorting data will be ignored.
+ \_cod -----------------------------
+
+\_newifi \_ifasciisorting \_asciisortingfalse
+\_def\_dosorting #1{%
+ \begingroup
+ \_ifx\_sotringlang\_undefined \_edef\_sortinglang{\_cs{_lan:\_the\_language}}\_fi
+ \_ifasciisorting
+ \_edef\_sortinglang{ASCII}%
+ \_def \_preparesorting##1{\_edef\_tmpb{\_ea\_ignorefirst\_csstring##1}}%
+ \_let \_setsecondarysorting=\_relax
+ \_else
+ \_setprimarysorting
+ \_fi
+ \_message{OpTeX: Sorting \_string#1 (\_sortinglang) ...^^J}%
+ \_def \_act##1{\_preparesorting ##1\_edef##1{\_tmpb}}%
+ \_ea\_xargs \_ea\_act #1;%
+ \_def \_act##1{\_addto #1{##1,}}%
+ \_edef #1{\_ea}\_ea\_xargs \_ea\_act #1;%
+ \_edef \_iilist{\_ea}\_ea\_mergesort #1\_end,\_end
+ \_ea\_endgroup
+ \_ea\_def\_ea#1\ea{\_iilist}%
+}
+
+ \_doc -----------------------------
+ The `\makeindex` prints the index. First, it sorts the `\_iilist`
+ second, it prints the sorted `\_iilist`, each item is printed
+ using `\_printiitem`.
+ \_cod -----------------------------
+
+\_def\_makeindex{\_par
+ \_ifx\_iilist\_empty \_opwarning{index data-buffer is empty. TeX me again}
+ \_else
+ \_dosorting \_iilist % sorting \_iilist
+ \_bgroup
+ \_rightskip=0pt plus1fil \_exhyphenpenalty=10000 \_leftskip=\_iindent
+ \_ea\_xargs \_ea\_printindexitem \_iilist ;\_par
+ \_egroup
+ \_fi
+}
+\_public \makeindex ;
+
+ \_doc -----------------------------
+ The `\_printindexitem \,<word>` prints one item to the index.
+ If `\_,<word>` is defined then this is used instead real <word>
+ (this exception is declared by `\iis` macro). Else <word> is printed by
+ `\_printii`. Finaly, `\_printiipages` prints the value of `\,<word>`,
+ i.e. the list of pages.
+ \_cod -----------------------------
+
+\_def\_printindexitem #1{%
+ \_ifcsname _\_csstring #1\_endcsname
+ \_ea\_ea\_ea \_printii \_csname _\_csstring #1\_endcsname &%
+ \_else
+ \_ea\_printii \_ea\_ignorefirst \_csstring #1&%
+ \_fi
+ \_ea\_printiipages #1&
+}
+
+ \_doc -----------------------------
+ `\printii <word>&` does more intelligent work because we are working with
+ words in the form `<main-word>/<sub-word>/<sub-sub-word>`.
+ The `\everyii` tokens register is applied before `\noindent`. User can
+ declare something special here.
+ \_cod -----------------------------
+
+\_def\_printii #1&{\_gdef\_currii{#1}\_the\_everyii\_noindent
+ \_hskip-\_iindent \_ignorespaces\_printiiA#1//}
+\_def\_printiiA #1/{\_if^#1^\_let\_previi=\_currii \_else
+ \_ea\_scanprevii\_previi/&\_edef\_tmpb{\_detokenize{#1}}%
+ \_ifx\_tmpa\_tmpb \_iiemdash \_else#1 \_gdef\_previi{}\_fi
+ \_expandafter\_printiiA\_fi
+}
+\_def\_iiemdash{\_kern.1em---\_space}
+
+\_def\_scanprevii#1/#2&{\_def\_previi{#2}\_edef\_tmpa{\_detokenize{#1}}}
+\_def\_previi{} % previous index item
+
+ \_doc -----------------------------
+ `\printiipages <pglist>&` gets <pglist> in the form
+ `<pg>:<type>,<pg>:<type>,...<pg>:<type>` and it converts them to
+ <pg>, <pg>, <from>--<to>, <pg> etc. The same pages must be printed only once
+ and continuos consequnces of pages must be comprimed to the form <from>-<to>.
+ Moreover, the consequence is continuous only if all pages have the same <type>.
+ Empty <type> is most common, pages with `b` <type> must be printed as bold
+ and with `i` <type> as italics.
+ Moreover, the <pg> meioned here are <gpageno>, but we have to print
+ <pageno>. The following macros solves these tasks.
+ \_cod -----------------------------
+
+\_def\_printiipages#1&{\_let\_pgtype=\_undefined \_tmpnum=0 \_printpages #1,:,\_par}
+\_def\_printpages#1:#2,{% state automaton for compriming pages
+ \_ifx,#1,\_uselastpgnum
+ \_else \_def\_tmpa{#2}%
+ \_ifx\_pgtype\_tmpa \_else
+ \_let\_pgtype=\_tmpa
+ \_uselastpgnum \_usepgcomma \_pgprint#1:{#2}%
+ \_tmpnum=#1 \_returnfi \_fi
+ \_ifnum\_tmpnum=#1 \_returnfi \_fi
+ \_advance\_tmpnum by1
+ \_ifnum\_tmpnum=#1 \_ifx\_lastpgnum\_undefined \_usepgdash\_fi
+ \_edef\_lastpgnum{\_the\_tmpnum:{\_pgtype}}%
+ \_returnfi \_fi
+ \_uselastpgnum \_usepgcomma \_pgprint#1:{#2}%
+ \_tmpnum=#1
+ \_relax
+ \_ea\_printpages \_fi
+}
+\_def\_returnfi #1\_relax{\_fi}
+\_def\_uselastpgnum{\_ifx\_lastpgnum\_undefined
+ \_else \_ea\_pgprint\_lastpgnum \_let\_lastpgnum=\_undefined \_fi
+}
+\_def\_usepgcomma{\_ifnum\_tmpnum>0, \_fi} % comma+space between page numbers
+\_def\_usepgdash{\_hbox{--}} % dash in the <from>--<to> form
+
+ \_doc -----------------------------
+ You can re-define `\_pgprint <gpageno>:{<iitype>}`
+ if you need to implement more <iitypes>.
+ \_cod -----------------------------
+
+\_def\_pgprint #1:#2{%
+ \_ifx,#2,\_pgprintA{#1}\_returnfi \_fi
+ \_ifx b#2{\_bf \_pgprintA{#1}}\_returnfi \_fi
+ \_ifx i#2{\_it \_pfprintA{#1}}\_returnfi \_fi
+ \_pgprintA{#1}\_relax
+}
+\_def\_pgprintA #1{\_ilink[pg:#1]{\_cs{_pgi:#1}}} % \ilink[pg:<gpageno>]{<pageno>}
+
+ \_doc -----------------------------
+ The `\iindex{<word>}` puts one <word> to the index. It writes
+ `\_Xindex{<word>}{<iitype>}` to the `.ref` file.
+ All othes variants of indexing macros expands internally to `\_iindex`.
+ \_cod -----------------------------
+
+\_def\_iindex#1{\_openref{\def~{ }%
+ \edef\_act{\_noexpand\_wref\_noexpand\_Xindex{{#1}{\_iitypesaved}}}\_act}}
+\_public \iindex ;
+
+ \_doc -----------------------------
+ The `\_Xindex{<word>}{<iitype>}` stores `\,<word>` to the `\_iilist` if
+ there is first occurence of the <word>. The list of pages where <word>
+ occurs, is the value of the macro `\,<word>`, so the <gpageno>:<iitype>
+ is appedned to this list.
+ Moreower, we need a mapping from <gpageno> to <pageno>, because we print
+ <pageno> in the index, but hyperlinks are implemented by <gpageno>.
+ So, the macro `\_pgi:<gpageno>` is defined as <pageno>.
+ \_cod -----------------------------
+
+\_def \_iilist {}
+\_def \_Xindex #1#2{\_ea\_XindexA \_csname ,#1\_ea\_endcsname \_currpage {#2}}
+\_def \_XindexA #1#2#3#4{% #1=\,<word> #2=<gpageno> #3=<pageno> #4=<iitype>
+ \_ifx#1\relax \_global\_addto \_iilist {#1}%
+ \_gdef #1{#2:#4}%
+ \else \_global\_addto #1{,#2:#4}%
+ \fi
+ \sxdef{_pgi:#2}{#3}%
+}
+
+ \_doc -----------------------------
+ The implementation of macros `\ii`, `\iid`, `\iis` follows.
+ Note that `\ii` works in horizontal mode on order to the `\write` whatsit
+ is not broken from the following word. If you need to keep vertical mode,
+ use `\_iindex{<word>}` directly.
+ \_cod -----------------------------
+
+\_def\_ii #1 {\_leavevmode\_def\_tmp{#1}\_iiA #1,,\_def\_iitypesaved{}}
+
+\_def\_iiA #1,{\_if$#1$\_else\_def\_tmpa{#1}%
+ \_ifx\_tmpa\_iiatsign \_ea\_iiB\_tmp,,\_else\_iindex{#1}\_fi
+ \_ea\_iiA\_fi}
+\_def\_iiatsign{@}
+
+\_def\_iiB #1,{\_if$#1$\_else \_iiC#1/\_relax \_ea\_iiB\_fi}
+\_def\_iiC #1/#2\_relax{\_if$#2$\_else\_iindex{#2#1}\_fi}
+
+\_def\_iid #1 {\_leavevmode\_iindex{#1}#1\_futurelet\_tmp\_iiD\_def\_iitypesaved{}}
+\_def\_iiD{\_ifx\_tmp,\_else\_ifx\_tmp.\_else\_space\_fi\_fi}
+
+\_def\_iis #1 #2{{\_def~{ }\_global\_sdef{_,#1}{#2}}\_ignorespaces}
+
+\_def\_iitypesaved{}
+\_def\_iitype #1{\_def\_iitypesaved{#1}\_ignorespaces}
+
+\_public \ii \iid \iis \iitype ;
+
+\_endcode % -------------------------------------
+
+
diff --git a/Master/texmf-dist/tex/luatex/optex/maketoc.opm b/Master/texmf-dist/tex/luatex/optex/maketoc.opm
index 05df7d0d647..6589c66f728 100644
--- a/Master/texmf-dist/tex/luatex/optex/maketoc.opm
+++ b/Master/texmf-dist/tex/luatex/optex/maketoc.opm
@@ -1,6 +1,25 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \maketoc {maketoc <2020-02-14>}
+\_codedecl \maketoc {Macros for maketoc <2020-02-14>}
+
+ \_doc ------------------------------------
+ `\_Xtoc{<level>}{<type>}{<number>}{<text>}` (in `.ref` file) reads the
+ specified data and saves it to the `\_toclist` as:
+
+ \begtt
+ \_tocline{<level>}{<type>}{<number>}{<text>}{<gpageno>}{<pageno>}
+ where:
+ <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
+ <text>: the title text
+ <gpageno>: the page number numbered from 1 independently of pagination
+ <pageno>: the page number used in the pagination
+ \endtt
+
+ The last two parameters are restored from previous
+ `\_Xpage{<pageno>}{<gpageno>}`, data are saved in the `\_currpage` macro.
+ \_cod ------------------------------------
\_def\_toclist{}
\_newifi \_ifischap \_ischapfalse
@@ -9,84 +28,92 @@
\_addto\_toclist{\_tocline{#1}{#2}{#3}{#4}}
\_ea\_addto\_ea\_toclist\_ea{\_currpage}%
}
-\def\_tocline#1#2#3#4#5#6{\_bgroup
- \_leftskip=\_iindent \_rightskip=2\_iindent
- \_ifischap \_advance\_leftskip by \_iindent \_fi
- \_def\_pg{\_ilink[pg:#5]}%
- \_pretocline \_the\_tochook
- \_ifcsname _tocl:#1\_endcsname
- \_cs{_tocl:#1}{#3}{#4}{#6}\_nobreak \_hskip-2\_iindent\_null \_par
- \_fi
- \_egroup
+
+ \_doc ------------------------------------
+ `\_tocline{<level>}{<type>}{<number>}{<text>}{<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>}{<text>}{<page>}` macro.
+ This macro starts with vertical mode,
+ inserts one record with given <level> and ends in horizontal mode. Then
+ `\_tocline` appends `\_nobreak \_hskip-2\_iindent\_null \_par`. This causes
+ that the last line of the record is shifted outside the margin given by
+ `\_rightskip`. A typical record (with long <text>) looks like:
+ \begtt
+ | |
+ \llap{<number>} text text text text text
+ text text text text text
+ text text .................... <pageno>
+ \endtt
+
+ Margins given by `\leftskip` and `\rightskip` are denoted by `|` in the
+ examle above.
+ \_cod ------------------------------------
+
+\def\_tocline#1#2#3#4#5#6{%
\_advance\_tocrefnum by1
+ \_bgroup
+ \_leftskip=\_iindent \_rightskip=2\_iindent
+ \_ifischap \_advance\_leftskip by \_iindent \_fi
+ \_def\_pg{\_ilink[pg:#5]}%
+ \_the\_everytocline
+ \_ifcsname _tocl:#1\_endcsname
+ \_cs{_tocl:#1}{#3}{#4}{#6}\_nobreak \_hskip-2\_iindent\_null \_par
+ \_fi
+ \_egroup
}
+
+ \_doc -----------------------------------
+ You can re-define default macros for each level of tocline if you want:
+ \_cod -----------------------------------
+
\_sdef{_tocl:1}#1#2#3{\_nofirst\_bigskip \_bf\_llaptoclink{#1}{#2}\_hfill \_pg{#3}}
\_sdef{_tocl:2}#1#2#3{\_llaptoclink{#1}{#2}\_tocdotfill \_pg{#3}}
\_sdef{_tocl:3}#1#2#3{\_advance\_leftskip by\_iindent \_cs{_tocl:2}{#1}{#2}{#3}}
-\_def\_llaptoclink#1{\_noindent \_llap{\_ilink[toc:\_the\_tocrefnum]{#1\enspace}}}
-\_def\_tocdotfill{\_leaders\_hbox to.8em{\_hss.\_hss}\_hskip 1em plus1fill\_relax}
+ \_doc -----------------------------------
+ The auxiliary macros are:
+ \begitems
+ * `\_llaptoclink<text>` does `\_noindent\_llap{<linked text>}`.
+ * `\_tocdotfill` creates dots in the TOC.
+ * `\_nofirst\macro` applies the `\macro` only if we don't print the first
+ record of the TOC.
+ * `\_pg{<pageno>}` creates <pageno> as link to real <gpage> saved in `#6`
+ of `\tocline`.
+ \enditems
+ \_cod ----------------------------------
+
+\_def\_llaptoclink#1{\_noindent
+ \_llap{\_ilink[toc:\_the\_tocrefnum]{\_enspace#1\_kern.4em}\kern.1em}}
+\_def\_tocdotfill{\_nobreak\_leaders\_hbox to.8em{\_hss.\_hss}\_hskip 1em plus1fill\_relax}
\_def\_nofirst #1{\_ifnum \_lastpenalty=11333 \_else #1\_fi}
-\_def\_pretocline{}
+ \_doc -----------------------------------
+ `\maketoc` prints warning if TOC data is empty, lse it creates TOC by
+ running `\_toclist`
+ \_cod ----------------------------------
\_def\_maketoc{\_par \_ifx\_toclist\_empty
\_opwarning{\_noexpand\maketoc -- data unavailable, TeX me again}\_openref
- \_else \_begingroup \_tocrefnum=0 \_penalty11333 \_toclist \_endgroup \_fi}
-
-\_newtoks \_tochook
-
-\_public \maketoc \tochook ;
-
-\_endcode % -------------------------------------
-
-`\_Xtoc{<level>}{<type>}{<number>}{<text>}` reads the specified
-data from REF file and saves it to `\_toclist` as
-
-\begtt
-\_tocline{<level>}{<type>}{<number>}{<text>}{<gpageno>}{<pageno>}
-where:
-<level>: 0 reserved, 1: chapter, 2: section, 3: subsection
-<type>: the type of the level, i.e. chap, sec, secc (unused)
-<number>: the number of the chapret/section/subsection in the format 1.2.3
-<text>: the title text
-<gpageno>: the page number numbered from 1 independently of pagination
-<pageno>: the page number used in the pagination
-\endtt
-
-The last two parameters are restored from previous
-`\_Xpage{<pageno>}{<gpageno>}`, data are saved in the `\_currpage` macro.
-
-`\_tocline{<level>}{<type>}{<number>}{<text>}{<gpageno>}{<pageno>}` prints
-the record to the table of contents. It opens group, reduces `\_leftskip`,
-`\_rightskip`, runs the `\tochook` (user can customise the design o TOC
-here) and runs `\_tocl:<level> {<number>}{<text>}{<page>}` macro.
-This macro starts with vertical mode,
-inserts one record with given <level> and ends in horizontal mode. Then
-`\_tocline` appends `\_nobreak \_hskip-2\_iindent\_null \_par`. This causes
-that the last line of the record is shifted outside the margin given by
-`\_rightskip`. A typical record (with long <text>) looks like:
-
-\begtt
- | |
-\llap{<number>} text text text text text
- text text text text text
- text text .................... <pageno>
-\endtt
-
-Margins given by `\leftskip` and `\rightskip` are denoted by `|` in the
-examle above.
+ \_else \_begingroup
+ \_tocrefnum=0 \_penalty11333
+ \_the\_regtoc \_toclist
+ \_endgroup \_fi
+}
-You can re-define default macros for each level if you want.
+ \_doc -----------------------------------
+ `\regmacro` appends its parameters to `\_regtoc`, `\_regmark` and
+ `\_regoul`. These token lists are used in `\maketoc`, `\_begoutput` and
+ `\pdfunidef`.
+ \_cod \_fin -----------------------------
-`\_llaptoclink<text>` does `\_noindent\_llap{<linked text>}`.
+\_newtoks \_regtoc \_newtoks \_regmark \_newtoks \_regoul
-`\_tocdotfill` creates dots in the TOC.
+\_def\_regmacro #1#2#3{%
+ \_toksapp\_regtoc{#1}\_toksapp\_regmark{#2}\_toksapp\_regoul{#3}%
+}
-`\_nofirst\macro` applies the `\macro` only if we don't print the first
-record of the TOC.
+\_public \maketoc \regmacro ;
-`\_pg{<pageno>}` creates <pageno> as link to real <gpage> saved in `#6`.
+\_endcode
-`\maketoc` prints warning if TOC data is empty, lse it creates TOC by
-running `\_toclist`
diff --git a/Master/texmf-dist/tex/luatex/optex/math-macros.opm b/Master/texmf-dist/tex/luatex/optex/math-macros.opm
index ea33dc396e5..ebd32fe2143 100644
--- a/Master/texmf-dist/tex/luatex/optex/math-macros.opm
+++ b/Master/texmf-dist/tex/luatex/optex/math-macros.opm
@@ -176,19 +176,19 @@
\_mathchardef\bigcap="1354
\_mathchardef\bigcup="1353
\_mathchardef\intop="1352
-\_protected\_def \int{\_intop\_nolimits} \private \intop;
+\_protected\_def \int{\_intop\_nolimits} \_private \intop;
\_mathchardef\prod="1351
\_mathchardef\sum="1350
\_mathchardef\bigotimes="134E
\_mathchardef\bigoplus="134C
\_mathchardef\bigodot="134A
\_mathchardef\ointop="1348
-\_protected\_def\_oint {\_ointop\_nolimits} \private \ointop;
+\_protected\_def\_oint {\_ointop\_nolimits} \_private \ointop;
\_mathchardef\bigsqcup="1346
\_mathchardef\smallint="1273
-\_mathchardef\_triangleleft="212F \public\triangleleft;
-\_mathchardef\_triangleright="212E \public\trianglerigt;
+\_mathchardef\triangleleft="212F \_private \triangleleft;
+\_mathchardef\triangleright="212E \_private \trianglerigt;
\_mathchardef\bigtriangleup="2234
\_mathchardef\bigtriangledown="2235
\_mathchardef\wedge="225E \let\land=\wedge
@@ -202,7 +202,7 @@
\_mathchardef\uplus="225D
\_mathchardef\amalg="2271
\_mathchardef\diamond="2205
-\_mathchardef\bullet="220F
+\_mathchardef\bullet="220F \_private \bullet;
\_mathchardef\wr="226F
\_mathchardef\div="2204
\_mathchardef\odot="220C
@@ -308,7 +308,8 @@
\_let\_sp=^ \public \sp ;
% \sb=_ , defined at beginning of this file
-\_protected\_def\,{\_mskip\_thinmuskip} \let\_thinsk = \,
+\_def\_thinsk {\_mskip\_thinmuskip}
+\_protected\_def\,{\_relax\_ifmmode \_thinsk \_else \_thinspace \_fi}
\_protected\_def\>{\_mskip\_medmuskip} \let\_medsk = \>
\_protected\_def\;{\_mskip\_thickmuskip} \let\_thicksk = \;
\_protected\_def\!{\_mskip-\_thinmuskip} \let\_thinneg = \!
@@ -810,6 +811,11 @@
\nLeftrightarrow \nleftrightarrow \nexists ;
\_public \not ;
+\_def\_mathbox#1{{\_mathchoice{\_mathboxA\_displaystyle[]{#1}}{\_mathboxA\_textstyle[]{#1}}
+ {\_mathboxA\_textstyle[700]{#1}}{\_mathboxA\_textstyle[500]{#1}}}}
+\_def\_mathboxA#1[#2]#3{\_hbox{\_everymath={#1}\_if^#2^\_else\_typoscale[#2/]\_relax\_fi #3}}
+\_public \mathbox ;
+
\_endcode %---------------------------------------------------
\secc The character `_` as subscript prefix
diff --git a/Master/texmf-dist/tex/luatex/optex/multicolumns.opm b/Master/texmf-dist/tex/luatex/optex/multicolumns.opm
new file mode 100644
index 00000000000..cc5a0fad091
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/multicolumns.opm
@@ -0,0 +1,103 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \begmulti {Balanced columns <2020-03-08>}
+
+ \_doc -----------------------------
+ This code is documented in detail in the \"\TeX/book naruby", pages 244--246,
+ free available, \url{http://petr.olsak.net/tbn.html}, but in Czech.
+ Roughly speaking, macros complete all material between `\begmulti` and `\endmulti`
+ into one `\vbox 6`. Then the macro measures the amount of free space at the current
+ page using `\pagegoal` and `\pagtotal` and does `\vsplit` of `\vbox 6` to
+ columns with height of such free space. This is done only if we have
+ enought amount of material in `\vbox 6` to fill full page by columns.
+ This is repeated in loop until we have less amount of material in `\vbox 6`.
+ Then we run `\_balancecolumns` which balances the last part of columns.
+ Each part of printed material is distributed to main vertical list as
+ `\hbox{<columns>}` and we need not do any change in the output routine.
+
+ If you have paragraphs in `\begmulti`... `\endmulti` environment then
+ you may say `\raggedright` inside this environment and you can re-assign
+ `\widowpenalty` and `\clubppenalty` (they are set to 10000 in \OpTeX/).
+ \_cod -----------------------------
+
+\_def\_multiskip{\_medskip} % space above and below \begmulti...\endmulti
+
+\_newcount\_mullines
+
+\_def\_begmulti #1 {\_par\_bgroup\_wipeepar\_multiskip\_penalty0 \_def\_Ncols{#1}
+ \_setbox6=\_vbox\_bgroup\_penalty0
+ %% \hsize := column width = (\hsize+\colsep) / n - \colsep
+ \_advance\_hsize by\_colsep
+ \_divide\_hsize by\_Ncols \_advance\_hsize by-\_colsep
+ \_mullines=0
+ \_def\par{\_ifhmode\_endgraf\_global\_advance\_mullines by\_prevgraf\_fi}%
+}
+\_def\_endmulti{\_vskip-\_prevdepth\_vfil
+ \_expandafter\_egroup\_expandafter\_baselineskip\_the\_baselineskip\_relax
+ \_dimen0=.8\_maxdimen \_tmpnum=\_dimen0 \_divide\_tmpnum by\_baselineskip
+ \_splittopskip=\_baselineskip
+ \_setbox1=\_vsplit6 to0pt
+ %% \dimen1 := the free space on the page
+ \_ifdim\_pagegoal=\_maxdimen \_dimen1=\_vsize \_corrsize{\_dimen1}
+ \_else \_dimen1=\_pagegoal \_advance\_dimen1 by-\_pagetotal \_fi
+ \_ifdim \_dimen1<2\_baselineskip
+ \_vfil\_break \_dimen1=\_vsize \_corrsize{\_dimen1} \_fi
+ \_ifnum\_mullines<\_tmpnum \_dimen0=\_ht6 \_else \_dimen0=.8\_maxdimen \_fi
+ \_divide\_dimen0 by\_Ncols \_relax
+ %% split the material to more pages?
+ \_ifdim \_dimen0>\_dimen1 \_splitpart
+ \_else \_balancecolumns \_fi % only balancing
+ \_multiskip\_egroup
+}
+\_def\_makecolumns{\_bgroup % full page, destination height: \dimen1
+ \_vbadness=20000 \_setbox1=\_hbox{}\_tmpnum=0
+ \_loop \_ifnum\_Ncols>\_tmpnum
+ \_advance\_tmpnum by1
+ \_setbox1=\_hbox{\_unhbox1 \_vsplit6 to\_dimen1 \_hss}
+ \_repeat
+ \_hbox{}\_nobreak\_vskip-\_splittopskip \_nointerlineskip
+ \_line{\_unhbox1\_unskip}
+ \_dimen0=\_dimen1 \_divide\_dimen0 by\_baselineskip \_multiply\_dimen0 by\_Ncols
+ \_global\_advance\_mullines by-\_dimen0
+ \_egroup
+}
+\_def\_splitpart{%
+ \_makecolumns % full page
+ \_vskip 0pt plus 1fil minus\_baselineskip \_break
+ \_ifnum\_mullines<\_tmpnum \_dimen0=\_ht6 \_else \_dimen0=.8\_maxdimen \_fi
+ \_divide\_dimen0 by\_Ncols \_relax
+ \_ifx\_balancecolumns\_flushcolumns \_advance\_dimen0 by-.5\_vsize \_fi
+ \_dimen1=\_vsize \_corrsize{\_dimen1}\_dimen2=\_dimen1
+ \_advance\_dimen2 by-\_Ncols\_baselineskip
+ %% split the material to more pages?
+ \_ifvoid6 \_else
+ \_ifdim \_dimen0>\_dimen2 \_expandafter\_expandafter\_expandafter \_splitpart
+ \_else \_balancecolumns % last balancing
+ \_fi \_fi
+}
+\_def\_balancecolumns{\_bgroup \_setbox7=\_copy6 % destination height: \dimen0
+ \_ifdim\_dimen0>\_baselineskip \_else \_dimen0=\_baselineskip \_fi
+ \_vbadness=20000
+ \_def\_tmp{%
+ \_setbox1=\_hbox{}\_tmpnum=0
+ \_loop \_ifnum\_Ncols>\_tmpnum
+ \_advance\_tmpnum by1
+ \_setbox1=\_hbox{\_unhbox1
+ \_ifvoid6 \_hbox to\_wd6{\_hss}\_else \_vsplit6 to\_dimen0 \_fi\_hss}
+ \_repeat
+ \_ifvoid6 \_else
+ \_advance \_dimen0 by.2\_baselineskip
+ \_setbox6=\_copy7
+ \_expandafter \_tmp \_fi}\_tmp
+ \_hbox{}\_nobreak\_vskip-\_splittopskip \_nointerlineskip
+ \_hbox to\_hsize{\_unhbox1\_unskip}%
+ \_egroup
+}
+\_def\_corrsize #1{%% #1 := #1 + \splittopskip - \topskip
+ \_advance #1 by \_splittopskip \_advance #1 by-\_topskip
+}
+\_public \begmulti \endmulti ;
+
+\_endcode % -------------------------------------
+
+
diff --git a/Master/texmf-dist/tex/luatex/optex/op-macros.opm b/Master/texmf-dist/tex/luatex/optex/op-macros.opm
index 00c8f587052..4cbb923b4cb 100644
--- a/Master/texmf-dist/tex/luatex/optex/op-macros.opm
+++ b/Master/texmf-dist/tex/luatex/optex/op-macros.opm
@@ -47,12 +47,19 @@
% \eoldef \foo #1{thex to end of line is: #1}
\_def\_eoldef #1{\_def #1{\_begingroup \_catcode`\^^M=12 \_eoldefA #1}%
- \_ea\_def\_csname _\_string #1:M\_endcsname}
+ \_ea\_def\_csname _\_csstring #1:M\_endcsname}
\_catcode`\^^M=12 %
-\_def\_eoldefA #1#2^^M{\_endgroup\_csname _\_string #1:M\_endcsname{#2}}%
+\_def\_eoldefA #1#2^^M{\_endgroup\_csname _\_csstring #1:M\_endcsname{#2}}%
\_normalcatcodes %
+\_eoldef\_skiptoeol#1{}
-\_public \opt \optdef \eoldef ;
+\_def\_bracedparam#1{\_ifcsname _\_csstring #1:M\_endcsname
+ \_csname _\_csstring #1:M\_ea \_endcsname
+ \_else \_csname __in\_csstring #1:M\_ea \_endcsname \_fi
+}
+
+
+\_public \opt \optdef \eoldef \skiptoeol ;
\_catcode`!=3 \_catcode`?=3
\_def\_replstring #1#2#3{% \replstring #1{stringA}{stringB}
@@ -83,23 +90,51 @@
\_def\_enquotes{\_chardef\"="201C } % use \"text" for English quotes
-%> \removespaces text with spaces {} -> textwithspaces
+% \removespaces text with spaces {} -> textwithspaces
\_def\_removespaces #1 {\_isempty{#1}\_iffalse #1\_ea\_removespaces\_fi}
-%> \trycs{<csname>}{<text>}
+ \_doc ----------------------------
+ `\trycs{<csname>}{<text>} expands to \<csname> if it is defined else to <text>.
+ \_cod ----------------------------
\_def \_trycs#1#2{\_ifcsname #1\_endcsname \_csname #1\_endcsname \_else #2\_fi}
+ \_doc ------------------
+ The pair {`\_doc ... \cod`} is used for documenting macros and to
+ printing the third part of main \OpTeX/ documentation: The
+ implementation. The syntax is:
+ {\begtt
+ \_doc <ignored text>
+ <documentation>
+ \_cod <ignored text>
+ \endtt}
+ The last {\_cod} in the file must be followed by `\_fin`. This is a
+ signal, that the following code does not ends by next `\_doc` but by
+ {`\_endcode`} command. The {`\_doc...\cod`} is redefined in macros used
+ for documentation printing.
+
+ The <documentation> (and <ignored text> too) must be <balanced text>.
+ It means that you canot document only `{` but you must document `}` too.
+ \_cod ------------------
+
+\_long\_def\_doc #1\_cod {\_skiptoeol}
+
+\_ea \_def \_ea\_ignorept \_ea#\_ea1\detokenize{pt}{#1}
+\_def\_ignoreit#1{}
+
\public
\setctable \restorectable
- \normalcatodes \opt \optdef \eoldef \replstring
- \keepinputnames \lastinputname \enquotes \removespaces \trycs ;
-
+ \normalcatodes \opt \optdef \eoldef \bracedparam \replstring
+ \keepinputnames \lastinputname \enquotes \removespaces \trycs
+ \ignorept \ignoreit ;
\_endcode % -------------------------------------
-\%> \trycs
-`\trycs{<csname>}{<text>} expands to \<csname> if it is defined else to <text>.
+The `\ignoreit` macro ignores next token. The \ignorept macro used ike this:
+\begtt
+\ea\ignorept \the\dimen...
+\endtt
+consumes the "pt" phrase appended to dimen value by `\the`.
diff --git a/Master/texmf-dist/tex/luatex/optex/opmac-rest.opm b/Master/texmf-dist/tex/luatex/optex/opmac-rest.opm
index 4353f891e2c..f8731fefdab 100644
--- a/Master/texmf-dist/tex/luatex/optex/opmac-rest.opm
+++ b/Master/texmf-dist/tex/luatex/optex/opmac-rest.opm
@@ -1,5 +1,3 @@
-%% This is part of OpTeX project, see http://petr.olsak.net/optex
-
% I plan to re-implement all macros from this file. Something is done already.
% OPmac
@@ -14,673 +12,34 @@
%%%%%%%%%%%%%% Basic macros, sec. 3.1 in opmac-d.pdf
-\newcount\tmpnum % auxiliary count
-\newdimen\tmpdim % auxiliary dimen
-
-\def\protectlist{}
-\def\addprotect#1{\addto\protectlist{\doprotect#1}}
-\addprotect~
-
-\ifx\pdfextension\undefined \else
- \let\pdfoutput=\outputmode \def\pdfcolorstackinit{\pdffeedback colorstackinit}\fi
-
-\newif\ifpdftex \pdftextrue
-
-\def\maybebreak{\afterassignment\maybebreakA\tmpdim=}
-\def\maybebreakA{\ifvmode \vskip0pt plus\tmpdim \penalty-130 \vskip0pt plus-\tmpdim
- \else \hskip0pt plus\tmpdim \penalty-130 \hskip0pt plus-\tmpdim \fi \relax
-}
-\let\\=\undefined
-\def\,{\relax\ifmmode \mskip\thinmuskip \else \thinspace \fi}
-\addprotect\, \addprotect\exfont
-
-\bgroup \catcode`!=3 \catcode`?=3
-\gdef\replacestrings#1#2{\long\def\replacestringsA##1#1{\def\tmpb{##1}\replacestringsB}%
- \long\def\replacestringsB##1#1{\ifx!##1\relax \else\addto\tmpb{#2##1}%
- \expandafter\replacestringsB\fi}% improved version <May 2016> inspired
- \expandafter\replacestringsA\tmpb?#1!#1% from pysyntax.tex by Petr Krajnik
- \long\def\replacestringsA##1?{\def\tmpb{##1}}\expandafter\replacestringsA\tmpb
-}
-\egroup
+%\newif\ifpdftex \pdftextrue
%%%%%%%%%%%%%% Global parameters, sec. 3.2 in opmac-d.pdf
-\widowpenalty=10000
-\clubpenalty=10000
-\showboxdepth=7
-\showboxbreadth=30
-
-\newdimen\_iindent \_iindent=\parindent
- % indentation of items, TOC, captions, list of bib. references
-\_public \iindent ;
-
-\def\iiskip{\medskip} % space above and below \begitems...\enditems
-\def\itemhook{} % hook in \startitem
-\def\bibskip{\smallskip} % space between bibitems
-
-\def\tabstrut{\strut} % strut in the \table
-\def\tabiteml{\enspace} % left material before each \table item
-\def\tabitemr{\enspace} % right material after each \table item
-\def\vvkern{1pt} % space between vertical lines
-\def\hhkern{1pt} % space between horizontal lines
-
-\def\multiskip{\medskip} % space above and below \begmulti...\endmulti
-\newdimen\colsep \colsep=2em % space between columns
-
-\newdimen\mnoteindent \mnoteindent=10pt % ditance between mnote and text
-\newdimen\mnotesize \mnotesize=20mm % the width of the mnote paragraph
-\newskip\titskip \titskip=4em % \vglue above title printed by \tit
-
-\def\picdir{} % the directory with picture files
-\def\bibtexhook{} % hook in \usebibtex and \usebbl macros
-\def\chaphook{} % hook in \chap
-\def\sechook{} % hook in \sec
-\def\secchook{} % hook in \secc
-\def\cnvhook{} % hook before conversion of outlines
-\def\prepghook{} % hook before page building in \output routine
-\def\pghook{} % next hook in \output routine
-\def\toclinehook{} % hook in \tocline
-\def\fnotehook{} % hook in \fnote
-\def\mnotehook{} % hook in \mnote
-\def\captionhook#1{} % hook in \caption (#1 is "t" or "f")
-
%%%%%%%%%%%%%% OPmac, CSplain and LaTeX logos, sec. 3.3 in opmac-d.pdf
-
%%%%%%%%%%%%%% Sizes of fonts and \baselineskip, sec. 3.4 in opmac-d.pdf
-
%%%%%%%%%%%%%% Multilingual support, sec. 3.5 in opmac-d.pdf
-\def\mtext#1{\_csname _mt:#1:\_trycs{_lan:\_the\_language}{en}\_endcsname}
-
-\sdef{_mt:chap:en}{Chapter} \sdef{_mt:chap:cs}{Kapitola} \sdef{_mt:chap:sk}{Kapitola}
-\sdef{_mt:t:en}{Table} \sdef{_mt:t:cs}{Tabulka} \sdef{_mt:t:sk}{Tabuľka}
-\sdef{_mt:f:en}{Figure} \sdef{_mt:f:cs}{Obrázek} \sdef{_mt:f:sk}{Obrázok}
-\sdef{_mt:subj:en}{Subject} \sdef{_mt:subj:cs}{Věc} \sdef{_mt:subj:sk}{Vec}
-
%%%%%%%%%%%%%% REF file, sec 3.6 in opmac-d.pdf
-
%%%%%%%%%%%%%% \label, \ref, \pgref, sec. 3.7 in opmac-d.pdf
-
%%%%%%%%%%%%%% Chapters, sections, subsections -- sec. 3.8 in opmac-d.pdf
-\def\printchap#1{\vfill\supereject
- {\chapfont \noindent \mtext{chap} \dotocnum{\thetocnum}\par
- \nobreak\smallskip\noindent #1\nbpar}\mark{}%
- \nobreak \remskip\bigskipamount \firstnoindent
-}
-\def\printsec#1{\par \norempenalty-400 \bigskip
- {\secfont \noindent \dotocnum{\thetocnum\quad}#1\nbpar}\insertmark{#1}%
- \nobreak \remskip\medskipamount \firstnoindent
-}
-\def\printsecc#1{\par \norempenalty-200 \medskip
- {\seccfont \noindent \dotocnum{\thetocnum\quad}#1\nbpar}%
- \nobreak \remskip\medskipamount \firstnoindent
-}
-\eoldef\tit#1{\vglue\titskip
- {\leftskip=0pt plus1fill \rightskip=\leftskip
- \titfont \noindent #1\par}%
- \nobreak\bigskip
-}
-\def\titfont{\scalemain\boldify\typoscale[\magstep4/\magstep5]}
-\def\chapfont{\scalemain\boldify\typoscale[\magstep3/\magstep3]}
-\def\secfont{\scalemain\boldify\typoscale[\magstep2/\magstep2]}
-\def\seccfont{\scalemain\boldify\typoscale[\magstep1/\magstep1]}
-
-\newcount\chapnum \newcount\secnum \newcount\seccnum \newcount\nonumnum
-\newif\ifnotoc \notocfalse \def\notoc{\global\notoctrue}
-\newif\ifnonum \nonumfalse \def\nonum{\global\nonumtrue}
-
-\eoldef\chap#1{\ifnonum\else \global\advance\chapnum by1 \fi
- \chaphook {\globaldefs=1 \secnum=0 \seccnum=0 \tnum=0 \fnum=0 \dnum=0}\relax
- \edef\thechapnum{\ifnonum\space\else\the\chapnum\fi}\let\thetocnum=\thechapnum
- \edef\thesecnum{\othe\chapnum.\the\secnum}%
- \def\dotocnumafter{\ea\wtotoc\ea{\thechapnum}1{chap}{#1}}%
- \printchap{#1}\resetnonumnotoc
-}
-\eoldef\sec#1{\ifnonum\else \global\advance\secnum by1 \fi
- \sechook {\globaldefs=1 \seccnum=0 \tnum=0 \fnum=0 \dnum=0}\relax
- \edef\thesecnum{\ifnonum\space\else\othe\chapnum.\the\secnum\fi}\let\thetocnum=\thesecnum
- \def\dotocnumafter{\ea\wtotoc\ea{\thesecnum}2{sec}{#1}}%
- \printsec{#1}\resetnonumnotoc
-}
-\eoldef\secc#1{\ifnonum\else \global\advance\seccnum by1 \fi
- \secchook {}\relax
- \edef\theseccnum{\ifnonum\space\else\othe\chapnum.\the\secnum.\the\seccnum\fi}\let\thetocnum=\theseccnum
- \def\dotocnumafter{\ea\wtotoc\ea{\theseccnum}3{secc}{#1}}%
- \printsecc{#1}\resetnonumnotoc
-}
-
-\def\wtotoc#1#2#3#4{% #1 = number, #2 = level, #3 = info, #4 = text
- \ifnotoc\else
- \_wref\_Xtoc{{#2}{#3}{#1}{\detokenize{#4}}}%
- \_incr\_tocrefnum
- \fi
-}
-\_def\_incr#1{\_global\_advance#1by1 }
-
-\_newcount\_tocrefnum
-
-\def\wcontents#1#2{% #1 = sequence to REF, #2 = titletext
- \ifnotoc\else
- \expandafter\_wref\expandafter#1\expandafter
- {\expandafter{\thetocnum}{#2}{\the\pageno}}%
- \fi
-}
-\def\dotocnum#1{%
- \leavevmode
- {\ifnonum \global\advance\nonumnum by1 \edef\thetocnum{!\the\nonumnum}\fi
- \wlabel\thetocnum
- \ifnotoc \else \_dest[toc:\_the\_tocrefnum]\fi
- \dotocnumafter}\ifnonum\else#1\fi
- \global\let\dotocnumafter=\relax
-}
-\def\resetnonumnotoc{\global\notocfalse \global\nonumfalse
- \ifx\dotocnumafter\relax \else
- \opwarning{\noexpand\dotocnum unused in printchap/printsec/printsecc}\fi
-}
-\def\insertmark#1{\toks0={#1}\mark{{\ifnonum\else\thetocnum\fi} {\the\toks0}}}
-
-\newskip\remskipamount
-\def\remskip{\afterassignment\remskipA \global\remskipamount}
-\def\remskipA{\vskip\remskipamount \penalty11333 }
-\def\norempenalty{\ifnum\lastpenalty=11333
- \vskip-\remskipamount \tmpnum=\else \removelastskip \penalty \fi}
-
-\def\othe#1.{\ifnum#1>0 \the#1.\fi}
-\def\thechapnum{} \def\thesecnum{} \def\theseccnum{}
-
-\def\afternoindent{\global\everypar={\_wipeepar\setbox7=\lastbox}}
-\def\_wipeepar{\global\everypar={}}
-\let\firstnoindent=\afternoindent
-\def\nbpar{{\interlinepenalty=10000\endgraf}}
-\def\nl{\hfil\break}
-\addto\_begoutput{\_def\nl{\_unskip\_space}}
-\addto\_pretocline{\_def\nl{\_unskip\_space}}
-
-
%%%%%%%%%%%%%% Captions, equations -- sec. 3.9 in opmac-d.pdf
-\newcount\tnum \newcount\fnum \newcount\dnum
-
-\def\thetnum{\thesecnum.\the\tnum}
-\def\thefnum{\thesecnum.\the\fnum}
-\def\thednum{(\the\dnum)}
-
-\def\caption/#1 {\isdefined{#1num}%
- \iftrue \global\advance \csname #1num\endcsname by1
- \else \opwarning{Unknown caption /#1}%
- \fi
- \bgroup
- \leftskip=\_iindent plus1fil
- \rightskip=\_iindent plus-1fil
- \parfillskip=0pt plus2fil
- \def\par{\nbpar\egroup}%
- \captionhook{#1}\noindent
- \wlabel{\csname the#1num\endcsname}%
- \printcaption{\mtext{#1}}{\csname the#1num\endcsname}%
-}
-\def\printcaption#1#2{{\bf#1 #2}\enspace}
-
-\expandafter\def\expandafter\endinsert\expandafter{\expandafter\par\endinsert}
-
-\def\eqmark{\global\advance\dnum by1
- \ifinner\else\eqno \fi
- \wlabel\thednum \thednum
-}
-
%%%%%%%%%%%%%% Items -- sec. 3.10 in opmac-d.pdf
-\newcount\itemnum \itemnum=0
-
-\def\begitems{\par\iiskip\bgroup
- \itemnum=0 \adef*{\startitem}
- \advance\leftskip by\_iindent
- \let\printitem=\normalitem
-}
-\def\enditems{\par\egroup\iiskip}
-
-\def\startitem{\par \advance\itemnum by1
- \itemhook \noindent\llap{\printitem}\ignorespaces}
-\def\normalitem{$\bullet$\enspace}
-
-\def\style#1{\expandafter\let\expandafter\printitem\csname item:#1\endcsname
- \ifx\printitem\relax \let\printitem=\normalitem \fi
-}
-\sdef{item:o}{\raise.4ex\hbox{$\scriptscriptstyle\bullet$} }
-\sdef{item:-}{- }
-\sdef{item:n}{\the\itemnum. }
-\sdef{item:N}{\the\itemnum) }
-\sdef{item:i}{(\romannumeral\itemnum) }
-\sdef{item:I}{\uppercase\expandafter{\romannumeral\itemnum}\kern.5em}
-\sdef{item:a}{\athe\itemnum) }
-\sdef{item:A}{\uppercase\expandafter{\athe\itemnum}) }
-\sdef{item:x}{\raise.3ex\fullrectangle{.6ex} }
-\sdef{item:X}{\raise.2ex\fullrectangle{1ex}\kern.5em}
-
-\def\fullrectangle#1{\hbox{\vrule height#1 width#1}}
-
-\def\athe#1{\ifcase#1?\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or
- m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\else ?\fi
-}
-
%%%%%%%%%%%%%% TOC -- sec. 3.11 in opmac-d.pdf
-
%%%%%%%%%%%%%% Index -- sec. 3.12 on opmac-d.pdf
-\def\iindex#1{\_openref\_wref\_Xindex{{#1}{\the\pageno}}}
-
-\def\ii #1 {\leavevmode\def\tmp{#1}\iiA #1,,}
-
-\def\iiA #1,{\if$#1$\else\def\tmpa{#1}%
- \ifx\tmpa\iiatsign \expandafter\iiB\tmp,,\else\iindex{#1}\fi
- \expandafter\iiA\fi}
-\def\iiatsign{@}
-
-\def\iiB #1,{\if$#1$\else \iiC#1/\relax \expandafter\iiB\fi}
-\def\iiC #1/#2\relax{\if$#2$\else\iindex{#2#1}\fi}
-
-\def\iid #1 {\leavevmode\iindex{#1}#1\futurelet\tmp\iiD}
-\def\iiD{\ifx\tmp,\else\ifx\tmp.\else\space\fi\fi}
-
-\def\_Xindex{\_Xindexg,}
-\def\_Xindexg#1#2#3{\bgroup \def~{ }% #1=prefix, #2=index-item, #3=pageno
- \isdefined{#1#2}\iftrue
- \ifx^#3^\else
- \expandafter\firstdata \csname#1#2\endcsname \_XindexA
- \ifnum#3=\tmpa % \ii on the same page
- \else
- \tmpnum=#3 \advance\tmpnum by\pgfolioB-1
- \expandafter\seconddata \csname#1#2\endcsname \_XindexB
- \ifx\tmp\empty
- \sxdef{#1#2}{{#3/+}{\pgfolioA{#3}}} % previous item: empty page
- \else
- \if\tmpb+% state: the pagelist ends by a pagenumber
- \ifnum\tmpnum=\tmpa % the consecutive page
- \sxdef{#1#2}{{#3/-}{\tmp\iiendash}}
- \else % the pages drop
- \sxdef{#1#2}{{#3/+}{\tmp, \pgfolioA{#3}}}
- \fi
- \else % state: the pagelist ends by --
- \ifnum\tmpnum=\tmpa % the consecutive page
- \sxdef{#1#2}{{#3/-}{\tmp}}
- \else % the pages drop
- \sxdef{#1#2}{{#3/+}{\tmp\pgfolioA{\tmpa}, \pgfolioA{#3}}}
- \fi\fi\fi\fi\fi
- \else % first occurrence of the index item #2
- \ifx^#3^\sxdef{#1#2}{{0/+}{}}\else \sxdef{#1#2}{{#3/+}{\pgfolioA{#3}}}\fi
- \ifx,#1
- \global \expandafter\addto \expandafter\iilist \csname#1#2\endcsname
- \else
- \isdefined{iilist:#1}\iftrue
- \global\expandafter\addto \csname iilist:#1\expandafter\endcsname \csname#1#2\endcsname
- \else \sxdef{iilist:#1}{\expandafter\noexpand \csname#1#2\endcsname}
- \fi\fi\fi
- \egroup
-}
-\def\iilist{} \def\iiendash{--}
-
-\def\firstdata#1#2{\expandafter\expandafter\expandafter #2\expandafter\firstdataA#1}
-\def\firstdataA#1#2{#1&}
-\def\seconddata#1#2{\expandafter\expandafter\expandafter #2\expandafter\seconddataA#1}
-\def\seconddataA#1#2{#2&}
-
-\def\_XindexA#1/#2&{\def\tmpa{#1}\let\tmpb=#2}
-\def\_XindexB#1&{\def\tmp{#1}}
-
-\def\pgfolioA#1{\ifnum#1<0 \romannumeral-\fi#1}
-\def\pgfolioB{\ifnum\tmpnum<0-\fi}
-
-\def\makeindex{\par
- \ifx\iilist\empty \opwarning{index data-buffer is empty. TeX me again}
- \else
- \bgroup
- \setprimarysorting
- \def\act##1{\ifx##1\relax \else
- \firstdata##1\_XindexA \seconddata##1\_XindexB
- \if\tmpb+%
- \preparesorting##1% converted item by sorting data in \tmpb
- \xdef##1{{\tmpb}{\tmp}}
- \else
- \preparesorting##1% converted item by sorting data in \tmpb
- \xdef##1{{\tmpb}{\tmp\pgfolioA{\tmpa}}}
- \fi
- \expandafter\act\fi}
- \expandafter \act \iilist \relax
- \egroup
- \dosorting % sorting is in progress
- \bgroup
- \rightskip=0pt plus1fil \exhyphenpenalty=10000 \leftskip=\_iindent
- \def\act##1{\ifx##1\relax \else \prepii##1%
- \seconddata##1\printiipages \expandafter\act \fi}
- \expandafter \act \iilist \relax
- \egroup
- \fi
-}
-\def\printiipages#1&{ #1\par}
-
-\def\prepii #1{\isinlist \iispeclist #1\iftrue
- \expandafter\expandafter\expandafter \printii \csname\string#1\endcsname&%
- \else \expandafter\prepiiA\string #1&%
- \fi
-}
-\def\prepiiA #1#2#3&{\printii#3&}
-
-\def\iis #1 #2{\bgroup \def~{ }%
- \global\expandafter\addto\expandafter\iispeclist\csname,#1\endcsname
- \global\sdef{\expandafter\string\csname,#1\endcsname}{#2}%
- \egroup \ignorespaces
-}
-\def\iispeclist{}
-
-\def\printii #1&{\gdef\currii{#1}\noindent\everyii
- \hskip-\_iindent \ignorespaces\printiiA#1//}
-\def\printiiA #1/{\if^#1^\let\previi=\currii \else
- \expandafter\scanprevii\previi/&\def\tmpb{#1}\edef\tmpb{\meaning\tmpb}%
- \ifx\tmpa\tmpb \iiemdash \else#1 \gdef\previi{}\fi
- \expandafter\printiiA\fi
-}
-\def\iiemdash{\kern.1em---\space}
-\def\everyii{}
-
-\def\scanprevii#1/#2&{\def\previi{#2}\def\tmpa{#1}\edef\tmpa{\meaning\tmpa}}
-\def\previi{} % previous index item
-
-%%%%%%%%%%%%%% Sorting -- sec. 3.13 in opmac-d.pdf
-
-\def\sortingdata{%
- /,{ },-,&,@,%
- aA\"a\"A\'a\'A,%
- bB,%
- cC,%
- \v c\v C,%
- dD\v d\v D,%
- eE\'e\'E\v e\v E,%
- fF,%
- gG,%
- hH,%
- ^^T^^U^^V,% ch Ch CH
- iI\'i\'I,%
- jJ,%
- kK,%
- lL\'l\'L\v l\v L,%
- mM,%
- nN\v n\v N,%
- oO\"o\"O\'o\'O\^o\^O,%
- pP,%
- qQ,%
- rR\'r\'R,%
- \v r\v R,%
- sS,%
- \v s\v S,%
- tT\v t\v T,%
- uU\"u\"U\'u\'U\r u\r U,%
- vV,%
- wW,%
- xX,%
- yY\'y\'Y,%
- zZ,%
- \v z\v Z,%
- 0,1,2,3,4,5,6,7,8,9,'.%
-}
-\def\setignoredchars{\setlccodes ,.;.?.!.:.'.".|.(.).[.].<.>.=.+.{}{}}
-\def\specsortingdatacs {ch:^^T Ch:^^U CH:^^V}
-\def\specsortingdatask {ch:^^T Ch:^^U CH:^^V} % DZ etc. are sorted normally
-
-\def\setprimarysorting {%
- \isdefined{sortingdata\csname _lan:\the\language\endcsname}\iftrue
- \expandafter \let\expandafter\sortingdata
- \csname sortingdata\csname _lan:\the\language\endcsname\endcsname
- \xdef\sortingmessage{using \string\sortingdata\csname _lan:\the\language\endcsname}%
- \else
- \xdef\sortingmessage{using internal \string\sortingdata}%
- \ifx\r\undefined
-% \opwarning{\noexpand\csaccents is unused, falling back to ASCII sorting}%
- \global\let\asciisorting=t%
- \fi\fi
- \ifx\asciisorting\undefined
- \xdef\sortingdata{\sortingdata}% expand sorting data now
- \isdefined{specsortingdata\csname _lan:\the\language\endcsname}\iftrue
- \xdef\specsortingdata{\csname specsortingdata\csname _lan:\the\language\endcsname
- \endcsname\space}%
- \expandafter\setprimarysortingA \meaning\specsortingdata\relax
- \else \gdef\specsortingdata{}\fi
- \else
- \gdef\sortingdata{.}\gdef\specsortingdata{}\gdef\sortingmessage{ASCII}%
- \fi
- \def\act##1{\ifx##1.\else
- \ifx##1,\advance\tmpnum by1
- \else \lccode`##1=\tmpnum \fi
- \expandafter \act \fi}%
- \tmpnum=60 \expandafter \act\sortingdata \setignoredchars
-}
-\def\setprimarysortingA#1->#2\relax{\gdef\specsortingdata{#2}}
-\def\sortingmessage{ASCII default}
-
-\def\setsecondarysorting {\def\act##1{\ifx##1.\else
- \ifx##1,\else \advance\tmpnum by1 \lccode`##1=\tmpnum \fi
- \expandafter \act \fi}%
- \tmpnum=60 \expandafter \act\sortingdata \setignoredchars
-}
-
-\def\preparesorting#1{\expandafter\preparesortingA\string#1&}
-\gdef\preparesortingA#1#2#3&{\xdef\tmpb{#3}%
- \expandafter\preparesortingB\specsortingdata.:{}
- \lowercase\expandafter{\expandafter\gdef\expandafter\tmpb\expandafter{\tmpb}}%
- \replacestrings{.}{}%
-}
-\def\preparesortingB#1#2:#3 {\ifx.#1\else \replacestrings{#1#2}{#3}\expandafter\preparesortingB\fi}
-
-\newif \ifAleB
-
-\def\isAleB #1#2{%
- \edef\tmp{\firstdata#1\empty\relax\firstdata#2\empty\relax \noexpand#1\noexpand#2}%
- \expandafter \testAleB \tmp
-}
-\def\testAleB #1#2\relax #3#4\relax #5#6{%
- \if #1#3\if #1&\testAleBsecondary #5#6%
- \else \testAleB #2\relax #4\relax #5#6%
- \fi
- \else \ifnum `#1<`#3 \AleBtrue \else \AleBfalse \fi
- \fi
-}
-\def\testAleBsecondary#1#2{%
- \bgroup
- \setsecondarysorting
- \preparesorting#1\let\tmpa=\tmpb \preparesorting#2%
- \edef\tmp{\tmpa0\relax\tmpb1\relax}%
- \expandafter\testAleBsecondaryX \tmp
- \egroup
-}
-\def\testAleBsecondaryX #1#2\relax #3#4\relax {%
- \if #1#3\testAleBsecondaryX #2\relax #4\relax
- \else \ifnum `#1<`#3 \global\AleBtrue \else \global \AleBfalse \fi
- \fi
-}
-\def\dosorting{%
- \message{Opmac: Sorting index (\sortingmessage)...}%
- \def\act##1{\ifx##1\relax\else \addto\iilist{##1,}%
- \expandafter\act\fi}%
- \edef\iilist{\expandafter}\expandafter\act \iilist\relax
- \edef\iilist{\expandafter}\expandafter\mergesort \iilist \end,\end
-}
-
-\def\mergesort #1#2,#3{% by Miroslav Olsak
- \ifx,#1% % prazdna-skupina,neco, (#2=neco #3=pokracovani)
- \addto\iilist{#2,}% % dvojice skupin vyresena
- \sortreturn{\fif\mergesort#3}% % \mergesort pokracovani
- \fi
- \ifx,#3% % neco,prazna-skupina, (#1#2=neco #3=,)
- \addto\iilist{#1#2,}% % dvojice skupin vyresena
- \sortreturn{\fif\mergesort}% % \mergesort dalsi
- \fi
- \ifx\end#3% % neco,konec (#1#2=neco)
- \ifx\empty\iilist % neco=kompletni setrideny seznam
- \def\iilist{#1#2}%
- \sortreturn{\fif\fif\gobbletoend}% % koncim
- \else % neco=posledni skupina nebo \end
- \sortreturn{\fif\fif % spojim \indexbuffer+necoa cele znova
- \edef\iilist{\expandafter}\expandafter\mergesort\iilist#1#2,#3}%
- \fi\fi % zatriduji: p1+neco1,p2+neco2, (#1#2=p1+neco1 #3=p2)
- \isAleB #1#3\ifAleB % p1<p2
- \addto\iilist{#1}% % p1 do bufferu
- \sortreturn{\fif\mergesort#2,#3}% % \mergesort neco1,p2+neco2,
- \else % p1>p2
- \addto\iilist{#3}% % p2 do bufferu
- \sortreturn{\fif\mergesort#1#2,}% % \mergesort p1+neco1,neco2,
- \fi
- \relax % zarazka, na ktere se zastavi \sortreturn
-}
-\def\sortreturn#1#2\fi\relax{#1} \def\fif{\fi}
-\def\gobbletoend #1\end{}
-
%%%%%%%%%%%%%% \begmulti ... \endmulti TBN p. 244, 245 -- sec. 3.14 in opmac-d.pdf
-\newcount\mullines
-\def\corrsize #1{%% #1 := #1 + \splittopskip - \topskip
- \advance #1 by \splittopskip \advance #1 by-\topskip
-}
-\def\begmulti #1 {\par\bgroup\_wipeepar\multiskip\penalty0 \def\Ncols{#1}
- \setbox6=\vbox\bgroup\penalty0
- %% \hsize := Sirka sloupce = (\hsize+\colsep) / n - \colsep
- \advance\hsize by\colsep
- \divide\hsize by\Ncols \advance\hsize by-\colsep
- \mullines=0
- \def\par{\ifhmode\endgraf\global\advance\mullines by\prevgraf\fi}%
-}
-\def\endmulti{\vskip-\prevdepth\vfil
- \expandafter\egroup\expandafter\baselineskip\the\baselineskip\relax
- \dimen0=.8\maxdimen \tmpnum=\dimen0 \divide\tmpnum by\baselineskip
- \splittopskip=\baselineskip
- \setbox1=\vsplit6 to0pt
- %% \dimen1 := the free space on the page
- \ifdim\pagegoal=\maxdimen \dimen1=\vsize \corrsize{\dimen1}
- \else \dimen1=\pagegoal \advance\dimen1 by-\pagetotal \fi
- \ifdim \dimen1<2\baselineskip
- \vfil\break \dimen1=\vsize \corrsize{\dimen1} \fi
- \ifnum\mullines<\tmpnum \dimen0=\ht6 \else \dimen0=.8\maxdimen \fi
- \divide\dimen0 by\Ncols \relax
- %% split the material to more pages?
- \ifdim \dimen0>\dimen1 \splitpart
- \else \balancecolumns \fi % only balancing
- \multiskip\egroup
-}
-\def\makecolumns{\bgroup % full page, destination height: \dimen1
- \vbadness=20000 \setbox1=\hbox{}\tmpnum=0
- \loop \ifnum\Ncols>\tmpnum
- \advance\tmpnum by1
- \setbox1=\hbox{\unhbox1 \vsplit6 to\dimen1 \hss}
- \repeat
- \hbox{}\nobreak\vskip-\splittopskip \nointerlineskip
- \line{\unhbox1\unskip}
- \dimen0=\dimen1 \divide\dimen0 by\baselineskip \multiply\dimen0 by\Ncols
- \global\advance\mullines by-\dimen0
- \egroup
-}
-\def\splitpart{%
- \makecolumns % full page
- \vskip 0pt plus 1fil minus\baselineskip \break
- \ifnum\mullines<\tmpnum \dimen0=\ht6 \else \dimen0=.8\maxdimen \fi
- \divide\dimen0 by\Ncols \relax
- \ifx\balancecolumns\flushcolumns \advance\dimen0 by-.5\vsize \fi
- \dimen1=\vsize \corrsize{\dimen1}\dimen2=\dimen1
- \advance\dimen2 by-\Ncols\baselineskip
- %% split the material to more pages?
- \ifvoid6 \else
- \ifdim \dimen0>\dimen2 \expandafter\expandafter\expandafter \splitpart
- \else \balancecolumns % last balancing
- \fi \fi
-}
-\def\balancecolumns{\bgroup \setbox7=\copy6 % destination height: \dimen0
- \ifdim\dimen0>\baselineskip \else \dimen0=\baselineskip \fi
- \vbadness=20000
- \def\tmp{%
- \setbox1=\hbox{}\tmpnum=0
- \loop \ifnum\Ncols>\tmpnum
- \advance\tmpnum by1
- \setbox1=\hbox{\unhbox1
- \ifvoid6 \hbox to\wd6{\hss}\else \vsplit6 to\dimen0 \fi\hss}
- \repeat
- \ifvoid6 \else
- \advance \dimen0 by.2\baselineskip
- \setbox6=\copy7
- \expandafter \tmp \fi}\tmp
- \hbox{}\nobreak\vskip-\splittopskip \nointerlineskip
- \hbox to\hsize{\unhbox1\unskip}%
- \egroup
-}
-
%%%%%%%%%%%%%% Colors -- sec. 3.15 in opmac-d.pdf
-\newif\iflocalcolor \localcolorfalse
-\let\localcolor=\localcolortrue
-\let\_localcolor=\localcolortrue
-
-
-% for backward compatibility:
-\let\longlocalcolor=\localcolor \let\locpgcolor=\relax
-\def\linecolor#1{}
-
-\def\Blue{\setcmykcolor{1 1 0 0}}
-\def\Red{\setcmykcolor{0 1 1 0}}
-\def\Brown{\setcmykcolor{0 0.67 0.67 0.5}}
-\def\Green{\setcmykcolor{1 0 1 0}}
-\def\Yellow{\setcmykcolor{0 0 1 0}}
-\def\Cyan{\setcmykcolor{1 0 0 0}}
-\def\Magenta{\setcmykcolor{0 1 0 0}}
-\def\White{\setcmykcolor{0 0 0 0}}
-\def\Grey{\setcmykcolor{0 0 0 0.5}}
-\def\LightGrey{\setcmykcolor{0 0 0 0.2}}
-\def\Black{\setcolor{\pdfblackcolor}}
-
-\def\setcmykcolor#1{\setcolor{\formatcmyk{#1}}}
-\def\setrgbcolor#1{\setcolor{\formatrgb{#1}}}
-\def\formatcmyk#1{#1 k #1 K}
-\def\formatrgb#1{#1 rg #1 RG}
-
-\def\setcolor#1{\global\let\ensureblacko=\ensureblackoA
- \iflocalcolor \edef\currentcolor{#1}\colorstackpush\currentcolor \aftergroup\colorstackpop
- \else \xdef\currentcolor{#1}\colorstackset\currentcolor \fi
-}
-
-\def\pdfblackcolor{0 g 0 G}
-\edef\currentcolor{\pdfblackcolor}
-\def\ensureblacko#1{#1}
-\def\ensureblackoA#1{\colorstackpush\pdfblackcolor #1\colorstackpop}
-
-\ifx\pdfcolorstackinit\undefined
- \def\colorstackpush#1{\pdfliteral{#1}}
- \def\colorstackpop{\colorstackpush\currentcolor}
- \let\colorstackset=\colorstackpush
-\else
- \mathchardef\colorstackcnt=0 % Implicit stack usage
- \def\colorstackpush#1{\pdfcolorstack\colorstackcnt push{#1}}
- \def\colorstackpop{\pdfcolorstack\colorstackcnt pop}
- \def\colorstackset#1{\pdfcolorstack\colorstackcnt set{#1}}
-\fi
-
-\addprotect\setcolor \addprotect\localcolor \addprotect\longlocalcolor
-
-\ifpdftex\else
- \def\setcolor#1{} \def\pdfliteral#1{}
-\fi
-
-\def\draft{\addto\prepghook{\draftbox{\_tenbf DRAFT}\nointerlineskip}}
-\def\draftbox#1{\vbox to0pt{\setbox0=\hbox{\typosize[10/]#1}%
- \kern.5\vsize \kern4\wd0 \hbox to0pt{\kern.5\hsize \kern-2.5\wd0
- \pdfsave \pdfrotate{55}\pdfscale{10}{10}%
- \hbox to0pt{\localcolor\LightGrey \box0\hss}%
- \pdfrestore
- \hss}\vss}}
-
-\ifpdftex\else
- \def\draft{\opwarning{\string\draft: Grey color is possible in pdfTeX only}}
-\fi
-
%%%%%%%%%%%%%% Hyperrefs -- sec. 3.16 in opmac-d.pdf
%%%%%%%%%%%%%% Outlines -- sec. 3.17 in opmac-d.pdf
@@ -689,456 +48,18 @@
%%%%%%%%%%%%%% \table -- sec. 3.19 in opmac-d.pdf
-\newtoks\tabdata
-\def\tabstrutA{\tabstrut}
-\newcount\colnum
-\def\ddlinedata{}
-\def\vvleft{}
-
-\def\table{\vbox\bgroup \catcode`\|=12 \tableA}
-\def\tableA#1#2{\offinterlineskip \colnum=0 \def\tmpa{}\tabdata={}\scantabdata#1\relax
- \halign\expandafter{\the\tabdata\cr#2\crcr}\egroup}
-
-\def\scantabdata#1{\let\next=\scantabdata
- \ifx\relax#1\let\next=\relax
- \else\ifx|#1\addtabvrule
- \else\ifx(#1\def\next{\scantabdataE}%
- \else\isinlist{123456789}#1\iftrue \def\next{\scantabdataC#1}%
- \else \expandafter\ifx\csname tabdeclare#1\endcsname \relax
- \expandafter\ifx\csname paramtabdeclare#1\endcsname \relax
- \opwarning{tab-declarator "#1" unknown, ignored}%
- \else \def\next{\expandafter\scantabdataB\csname paramtabdeclare#1\endcsname}\fi
- \else \def\next{\expandafter\scantabdataA \csname tabdeclare#1\endcsname}%
- \fi\fi\fi\fi\fi \next
-}
-\def\scantabdataA#1{\addtabitem \expandafter\addtabdata\expandafter{#1\tabstrutA}\scantabdata}
-\def\scantabdataB#1#2{\addtabitem\expandafter\addtabdata\expandafter{#1{#2}\tabstrutA}\scantabdata}
-\def\scantabdataC {\def\tmpb{}\afterassignment\scantabdataD \tmpnum=}
-\def\scantabdataD#1{\loop \ifnum\tmpnum>0 \advance\tmpnum by-1 \addto\tmpb{#1}\repeat
- \expandafter\scantabdata\tmpb}
-\def\scantabdataE#1){\addtabdata{#1}\scantabdata}
-\def\tabdeclarec{\tabiteml\hfil##\unsskip\hfil\tabitemr}
-\def\tabdeclarel{\tabiteml##\unsskip\hfil\tabitemr}
-\def\tabdeclarer{\tabiteml\hfil##\unsskip\tabitemr}
-\def\paramtabdeclarep#1{\tabiteml\vtop{\hsize=#1\relax \baselineskip=\normalbaselineskip
- \lineskiplimit=0pt \noindent##\unsskip \vbox to0pt{\vss\hbox{\tabstrutA}}}\tabitemr}
-
-\def\unsskip{\ifdim\lastskip>0pt \unskip\fi}
-\def\addtabitem{\ifnum\colnum>0 \addtabdata{&}\addto\ddlinedata{&\dditem}\fi
- \advance\colnum by1 \let\tmpa=\relax}
-\def\addtabdata#1{\tabdata\expandafter{\the\tabdata#1}}
-\def\addtabvrule{%
- \ifx\tmpa\vrule \addtabdata{\kern\vvkern}%
- \ifnum\colnum=0 \addto\vvleft{\vvitem}\else\addto\ddlinedata{\vvitem}\fi
- \else \ifnum\colnum=0 \addto\vvleft{\vvitemA}\else\addto\ddlinedata{\vvitemA}\fi\fi
- \let\tmpa=\vrule \addtabdata{\vrule}}
-
-\def\crl{\crcr\noalign{\hrule}}
-\def\crll{\crcr\noalign{\hrule\kern\hhkern\hrule}}
-
-\def\crli{\crcr \omit
- \gdef\dditem{\omit\tablinefil}\gdef\vvitem{\kern\vvkern\vrule}\gdef\vvitemA{\vrule}%
- \vvleft\tablinefil\ddlinedata\crcr}
-\def\crlli{\crli\noalign{\kern\hhkern}\crli}
-\def\tablinefil{\leaders\hrule\hfil}
-
-\def\crlp#1{\crcr \noalign{\kern-\drulewidth}%
- \omit \xdef\crlplist{#1}\xdef\crlplist{,\expandafter}\expandafter\crlpA\crlplist,\end,%
- \global\tmpnum=0 \gdef\dditem{\omit\crlpD}%
- \gdef\vvitem{\kern\vvkern\kern\drulewidth}\gdef\vvitemA{\kern\drulewidth}%
- \vvleft\crlpD\ddlinedata \global\tmpnum=0 \crcr}
-\def\crlpA#1,{\ifx\end#1\else \crlpB#1-\end,\expandafter\crlpA\fi}
-\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,}}%
- \tmpa\iftrue \kern-\drulewidth \tablinefil \kern-\drulewidth\else\hfil \fi}
-
-\def\tskip{\afterassignment\tskipA \tmpdim}
-\def\tskipA{\gdef\dditem{}\gdef\vvitem{}\gdef\vvitemA{}\gdef\tabstrutA{}%
- \vbox to\tmpdim{}\ddlinedata \crcr \noalign{\gdef\tabstrutA{\tabstrut}}}
-
-\def\mspan{\omit \tabdata={\tabstrut}\let\tmpa=\relax \afterassignment\mspanA \_mscount=}
-\def\mspanA[#1]#2{\loop \ifnum\_mscount>1 \csname span\endcsname \omit \advance\_mscount-1 \repeat
- \colnum=0 \def\tmpa{}\tabdata={}\scantabdata#1\relax
- \setbox0=\vbox{\halign\expandafter{\the\tabdata\cr#2\crcr}\global\setbox8=\lastbox}%
- \setbox0=\hbox{\unhbox8 \unskip \global\setbox8=\lastbox}%
- \unhbox8 \ignorespaces}
-
-\newdimen\drulewidth \drulewidth=0.4pt
-\let\orihrule=\hrule \let\orivrule=\vrule
-\def\rulewidth{\afterassignment\rulewidthA \drulewidth}
-\def\rulewidthA{\edef\hrule{\orihrule height\the\drulewidth}%
- \edef\vrule{\orivrule width\the\drulewidth}}
-
-\long\def\frame#1{%
- \hbox{\vrule\vtop{\vbox{\hrule\kern\vvkern
- \hbox{\kern\hhkern\relax#1\kern\hhkern}%
- }\kern\vvkern\hrule}\vrule}}
-
%%%%%%%%%%%%%% \inspic -- sec. 3.20 in opmac-d.pdf
-\newdimen\picwidth \picwidth=0pt \let\picw=\picwidth
-\newdimen\picheight \picheight=0pt
-
-\ifpdftex
- \def\inspic #1 {\hbox{%
- \pdfximage \ifdim\picwidth=0pt \else width\picwidth\fi
- \ifdim\picheight=0pt \else height\picheight\fi \inspicpage {\picdir#1}%
- \pdfrefximage\pdflastximage}}
-\else
- \def\inspic #1 {\opwarning
- {The \noexpand\inspic is supported for PDF output only}}
-\fi
-\def\inspicpage{}
-
%%%%%%%%%%%%%%% transformation matrix -- sec. 3.21 in opmac-d.pdf
-\def\pdfscale#1#2{\pdfsetmatrix{#1 0 0 #2}}
-
-\def\pdfrotate#1{\tmpdim=#1pt
- \ifdim\tmpdim=0pt
- \else \ifdim\tmpdim=90pt \pdfsetmatrix{0 1 -1 0}%
- \else \edef\tmp{#1}\expandafter\pdfrotateA\tmp..\relax
- \fi \fi
-}
-\def\pdfrotateA #1.#2.#3\relax{%
- \def\tmp##1.##2\relax {##1}%
- \tmpnum=\expandafter \tmp \the\tmpdim \relax % round
- \ifdim\tmpdim>0pt \def\tmpa{}\else\def\tmpa{-}\fi % save -
- \loop \ifnum\tmpnum<0 \advance\tmpnum by360 \repeat
- \loop \ifnum\tmpnum>360 \advance\tmpnum by-360 \repeat
- \loop \ifnum\tmpnum>90 \pdfrotate{90}\advance\tmpnum by-90 \repeat
- \ifnum\tmpnum=90 \pdfrotate{90}\else
- \ifnum\tmpnum>44 \pdfsetmatrix{.7071 .7071 -.7071 .7071}%
- \advance\tmpnum by-45 \fi
- \ifnum\tmpnum>22 \pdfsetmatrix{.9272 .3746 -.3746 .9272}%
- \advance\tmpnum by-22 \fi
- \ifnum\tmpnum>0
- \pdfsetmatrix{\smallcos \smallsin -\smallsin \smallcos}%
- \fi\fi
- \if$#2$\else % fraction part
- \tmpdim=.01745329pt % \pi/180
- \tmpdim=.#2\tmpdim %
- \edef\tmp{\expandafter\ignorept\the\tmpdim\space}%
- \ifx\tmpa\empty \pdfsetmatrix{1 \tmp -\tmp 1}%
- \else \pdfsetmatrix{1 -\tmp \tmp 1}%
- \fi\fi
-}
-\def\smallcos{.\ifcase\tmpnum \or9998\or9994\or9986\or9976\or9962\or9945\or
- 9925\or9903\or9877\or9848\or9816\or9781\or9744\or9703\or9659\or9613\or
- 9563\or9511\or9455\or9397\or9336\or9272\fi\space}
-\def\smallsin{.\ifcase\tmpnum 0\or0175\or0359\or0523\or0698\or0872\or1045\or
- 1219\or1391\or1564\or1736\or1908\or2079\or2250\or2419\or2588\or2756\or
- 2924\or309\or3256\or342\or3584\or3746\fi\space}
-
-\ifpdftex \else
- \def\pdfsetmatrix#1{} \def\pdfsave{} \def\pdfrestore{}
-\fi
-
%%%%%%%%%%%%%% \fnote, \mnote -- sec 3.22 in opmac-d.pdf
-\newcount\_fnotenum \_fnotenum=0
-\newcount\_fnotenumlocal
-\newif\iflocfnum \locfnumtrue
-
-\long\def\fnoteG#1{\global\advance \_fnotenum by1
- \ifx\relax#1\relax\else\leavevmode\fi
- \iflocfnum \_openref\_wref\_Xfnote{}%
- \isdefined{fn:\the\_fnotenum}\iftrue
- \else\opwarning{unknown \noexpand\fnote mark. TeX me again}\fi\fi
- #1\_opfootnote\fnset\fnmarkx
-}
-\def\fnset{\everypar={}\fnotehook\scalemain\typoscale[800/800]}
-\def\fnote{\fnoteG\fnmarkx}
-\def\fnotetext{\fnoteG{}}
-
-\def\fnotemark#1{{\advance\_fnotenum by#1\relax \fnmarkx}}
-\def\fnmarkx{\isdefined{fn:\the\_fnotenum}\iftrue\thefnote\else$^?$\fi}
-\def\thefnote{$^{\locfnum}$}
-\def\locfnum{\csname fn:\the\_fnotenum\endcsname}
-
-\def\_Xfnote{\advance\_fnotenumlocal by1 \advance\_fnotenum by1
- \sxdef{fn:\the\_fnotenum}{\the\_fnotenumlocal}}
-
-\def\runningfnotes{\locfnumfalse\def\locfnum{\the\_fnotenum}\def\fnmarkx{\thefnote}}
-
-\newcount\_mnotenum \_mnotenum=0 % global counter of mnotes
-\newdimen\mnoteskip \mnoteskip=0pt
-
-\long\def\mnote#1{\ifvmode \hbox{\vbox to\ht\strutbox{}\mnoteA{#1}}\nobreak\vskip-\baselineskip
- \else \strut\vadjust{\kern-\dp\strutbox \mnoteA{#1}\kern\dp\strutbox}%
- \fi
-}
-\long\def\mnoteA#1{\global\advance \_mnotenum by1
- \ifx\mnotesfixed\undefined
- \isdefined{mn:\the\_mnotenum}\iftrue
- \else\opwarning{unknown \noexpand\mnote side. TeX me again}\fi
- \edef\tmp{\csname mn:\the\_mnotenum\endcsname}%
- \_openref\_wref\_Xmnote{}\ifvmode\nobreak\fi
- \else \let\tmp=\mnotesfixed \fi
- \expandafter\ifx\tmp \left
- \hbox to0pt{\kern-\mnotesize \kern-\mnoteindent
- \vbox to0pt{\vss \setbox0=\vtop{\hsize=\mnotesize
- \leftskip=0pt plus 1fill \rightskip=0pt {\mnotehook\noindent#1\endgraf}}%
- \dp0=0pt \box0 \kern\mnoteskip \global\mnoteskip=0pt}\hss}%
- \else
- \hbox to0pt{\kern\hsize \kern\mnoteindent
- \vbox to0pt{\vss \setbox0=\vtop{\hsize=\mnotesize
- \rightskip=0pt plus 1fil \leftskip=0pt {\mnotehook\noindent#1\endgraf}}%
- \dp0=0pt \box0 \kern\mnoteskip \global\mnoteskip=0pt}\hss}%
- \fi
-}
-\def\_Xmnote{\advance\_mnotenum by1
- \sxdef{mn:\the\_mnotenum}{\ifodd\lastpage \right \else \left \fi}}
-
-\def\fixmnotes#1{\def\mnotesfixed{#1}}
-
-\_addto\_begoutput{\def\fnote##1{}\def\fnotemark##1{}}
-\_addto\_pretocline{\def\fnote##1{}\def\fnotemark##1{}}
-
%%%%%%%%%%%%%% \cite, \bib, \usebibtex, \usebbl -- sec. 3.23 in opmac-d.pdf
-\newwrite\auxfile % AUX file for BibTeX
-\newcount\bibnum % the bibitem counter
-\newtoks\bibmark % the bibmark used if \nonumcitations
-\newcount\lastcitenum \lastcitenum=0 % for \shortcitations
-
-\def\cite[#1]{{\citeA#1,,,[\printsavedcites]}}
-\def\nocite[#1]{{\citeA#1,,,}}
-\def\rcite[#1]{{\citeA#1,,,\printsavedcites}}
-\def\savedcites{}
-
-\def\citeA #1#2,{\if#1,\else
- \if *#1\addcitelist{*}\expandafter \skiptorelax \fi
- \isdefined{bib:#1#2}\iftrue \else
- \addcitelist{#1#2}%
- \opwarning{The cite [#1#2] unknown. Try to TeX me again}\_openref
- \addto\savedcites{?,}\def\sortcitesA{}\lastcitenum=0
- \expandafter\gdef\csname bib:#1#2\endcsname {}%
- \expandafter \skiptorelax \fi
- \expandafter \ifx \csname bib:#1#2\endcsname \empty
- \addto\savedcites{?,}\def\sortcitesA{}\lastcitenum=0
- \expandafter \skiptorelax \fi
- \def\bibnn##1{}%
- \if &\csname bib:#1#2\endcsname
- \addcitelist{#1#2}%
- \def\bibnn##1##2{##1}%
- \sxdef{bib:#1#2}{\csname bib:#1#2\endcsname}%
- \fi
- \edef\savedcites{\savedcites \csname bib:#1#2\endcsname,}%
- \relax
- \expandafter\citeA\fi
-}
-\def\printsavedcites{\sortcitesA
- \chardef\tmpb=0 \expandafter\citeB\savedcites,%
- \ifnum\tmpb>0 \printdashcite{\the\tmpb}\fi
-}
-\def\sortcitesA{}
-\def\sortcitations{%
- \def\sortcitesA{\edef\savedcites{300000,\expandafter}\expandafter\sortcitesB\savedcites,%
- \def\tmpa####1300000,{\def\savedcites{####1}}\expandafter\tmpa\savedcites}%
-}
-\def\sortcitesB #1,{\if $#1$%
- \else
- \mathchardef\tmpa=#1
- \edef\savedcites{\expandafter}\expandafter\sortcitesC \savedcites\end
- \expandafter\sortcitesB
- \fi
-}
-\def\sortcitesC#1,{\ifnum\tmpa<#1\edef\tmpa{\the\tmpa,#1}\expandafter\sortcitesD
- \else\edef\savedcites{\savedcites#1,}\expandafter\sortcitesC\fi}
-\def\sortcitesD#1\end{\edef\savedcites{\savedcites\tmpa,#1}}
-
-\def\citeB#1,{\if$#1$\else
- \if?#1\relax??%
- \else
- \ifnum\lastcitenum=0 % only comma separated list
- \printcite{#1}%
- \else
- \ifx\citesep\empty % first cite item
- \lastcitenum=#1\relax
- \printcite{#1}%
- \else % next cite item
- \advance\lastcitenum by1
- \ifnum\lastcitenum=#1\relax % cosecutive cite item
- \mathchardef\tmpb=\lastcitenum
- \else % there is a gap between cite items
- \lastcitenum=#1\relax
- \ifnum\tmpb=0 % previous items were printed
- \printcite{#1}%
- \else
- \printdashcite{\the\tmpb}\printcite{#1}\chardef\tmpb=0
- \fi\fi\fi\fi\fi
- \expandafter\citeB\fi
-}
-\def\shortcitations{\lastcitenum=1 }
-
-\def\printcite#1{\citesep\_ilink[cite:#1]{\citelinkA{#1}}\def\citesep{,\hskip.2em\relax}}
-\def\printdashcite#1{\ifmmode-\else\hbox{--}\fi\_ilink[cite:#1]{\citelinkA{#1}}}
-\def\citesep{}
-
-\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 BibTeX style}\fi}
-}
-\def\citelinkA{}
-
-\def\ecite[#1]{\bgroup\citeA#1,,,\expandafter\eciteB\savedcites;}
-\def\eciteB#1,#2;#3{\if?#1\relax #3\else \_ilink[cite:#1]{#3}\fi\egroup}
-
-\def\bib[#1]{\def\tmp{\isnextchar={\bibA[#1]}{\bibmark={}\bibB[#1]}}%
- \expandafter\tmp\romannumeral-`\.} % ignore optional space
-\def\bibA[#1]=#2{\bibmark={#2}\bibB[#1]}
-\def\bibB[#1]{\par \ifnum\bibnum>0 \bibskip \fi
- \advance\bibnum by1
- \noindent \def\tmpb{#1}\wbib{#1}{\the\bibnum}{\the\bibmark}%
- \printbib \ignorespaces
-}
-\def\wbib#1#2#3{\_dest[cite:\the\bibnum]%
- \ifx\_wref\wrefrelax\else \immediate\_wref\_Xbib{{#1}{#2}{#3}}\fi}
-
-\def\_Xbib#1#2#3{\sdef{bib:#1}{\bibnn{#2}&}\if^#3^\else\sdef{bim:#2}{#3}\fi\def\lastbibnum{#2}}
-
-\def\printbib{\hangindent=\_iindent
- \ifx\citelinkA\empty \noindent\hskip\_iindent \llap{[\the\bibnum] }%
- \else \noindent \fi
-}
-
-\def\addcitelist#1{\global\addto\citelist{\citeI[#1]}}
-\def\writeaux#1{\immediate\write\auxfile{\string\citation{#1}}}
-\def\writeXcite#1{\_openref\immediate\_wref\_Xcite{{#1}}}
-\def\citelist{} \def\citelistB{}
-
-\def\usebibtex#1#2{%
- \_openref \openauxfile{#1}{#2}%
- \def\citeI[##1]{\writeaux{##1}}\citelist
- \global\let\addcitelist=\writeaux
- \bgroup \readbblfile{\jobname}\egroup
-}
-\def\openauxfile#1#2{%
- \immediate\openout\auxfile=\jobname.aux
- \immediate\write\auxfile
- {\_pcent\_pcent\space Opmac: AUX file reserved for bibtex only}%
- \immediate\write\auxfile{\string\bibdata{#1}}%
- \immediate\write\auxfile{\string\bibstyle{#2}}%
-}
-\def\readbblfile #1{%
- \openin\testin=#1.bbl
- \ifeof\testin
- \opwarning{The `#1.bbl' file doesn't exist. Use `bibtex'..}%
- \else
- \closein\testin
- \bibnum=0
- \long\def\begin##1\bibitem{\bibitem}\def\end##1{}% LaTeX environment
- \def\httpAddr##1{\url{http:##1}}\def\\{\hfill\break}%
- \def\newblock{\hskip .11em plus.33em minus.07em}%
- \def\mbox{\leavevmode\hbox}\def\emph##1{{\it##1}}%
- \parindent=\_iindent \bibtexhook\relax
- \input #1.bbl
- \par
- \fi
-}
-\def\bibitem{\isnextchar[{\bibitemB}{\bibmark={}\bibitemC}}
-\def\bibitemB[#1]{\bibmark={#1}\bibitemC}
-\def\bibitemC#1{\bibitemD{#1}}
-\def\bibitemD#1{\par\ifnum\bibnum>0 \bibskip \fi
- \advance\bibnum by1
- \noindent \def\tmpb{#1}\wbib{#1}{\the\bibnum}{\the\bibmark}%
- \printbib \ignorespaces
-}
-\def\genbbl#1#2{\openauxfile{#1}{#2}%
- \immediate\write\auxfile{\string\citation{*}}%
- \bgroup
- \_iindent=4em
- \def\bibitemC##1{\par\ifnum\bibnum>0 \bibskip \fi
- \advance\bibnum by1
- \noindent \hangindent=\parindent
- \indent \llap{[##1]\enspace}\ignorespaces
- }%
- \readbblfile{\jobname}%
- \egroup
-}
-\def\usebbl/#1 #2 {\isdefined{bbl:#1}%
- \iftrue \csname bbl:#1\endcsname {#2}\else
- \opwarning{\string\usebbl/#1 #2 ... the `#1' type undefined}%
- \fi
-}
-\sdef{bbl:a}#1{\bgroup \readbblfile{#1}\egroup}
-
-\sdef{bbl:b}#1{\bgroup
- \let\citeI=\relax \xdef\citelist{\citelist\citelistB}%
- \def\bibitemC##1 ##2\par{%
- \isinlist\citelist{[##1]}\iftrue \bibitemD{##1}##2\par\fi}%
- \readbblfile{#1}%
- \global\let\addcitelist=\writeXcite
- \egroup
-}
-\sdef{bbl:c}#1{\bgroup
- \ifx\citelinkA\empty \else
- \opwarning{\string\nonumcitations: don't use \string\usebbl/c}\fi
- \let\citeI=\relax \xdef\citelist{\citelist\citelistB}%
- \def\bibitemC##1 ##2\par{%
- \isinlist\citelist{[##1]}\iftrue
- \if^\the\bibmark^\sdef{bb:##1}{\bibitemD{##1}##2\par}%
- \else \toks0={##2\par}%
- \edef\tmpa{\noexpand\sdef{bb:##1}{% \the\bibmark have to expand
- \noexpand\bibitemB[\the\bibmark]{##1}\the\toks0}}\tmpa
- \fi\fi}%
- \readbblfile{#1}%
- \def\bibitemC##1{\bibitemD{##1}}%
- \def\citeI[##1]{\csname bb:##1\endcsname}\citelist
- \global\let\addcitelist=\writeXcite
- \egroup
-}
-\def\_Xcite#1{\addto\citelistB{\citeI[#1]}}
-
-\newcatcodetable\savedcatcodes
-
-\def\usebib{\par \_opinput {usebib.opm} \usebib}
-
%%%%%%%%%%%%%% output -- sec. 3.24 in opmac-d.pdf
-
-\def\doprotect#1{\let#1=\relax}
-\def\_pagedest{\def\destheight{25pt}\_dest[pg:\_the\_gpageno]}
-
-%\footline={\hss\_tenrm\thefontsize[10]\folio\hss}
-
%%%%%%%%%%%%%% margins -- sec. 3.25 in opmac-d.pdf
-
%%%%%%%%%%%%%% Pre-defined document styles
-\def\boxlines{%
- \def\boxlinesE{\ifhmode\egroup\empty\fi}\def\nl{\boxlinesE}%
- \bgroup \lccode`\~=`\^^M\lowercase{\egroup\let~}\boxlinesE
- \everypar{\setbox0=\lastbox\endgraf
- \hbox\bgroup \catcode`\^^M=13 \let\par=\nl \aftergroup\boxlinesC}%
-}
-\def\boxlinesC{\futurelet\next\boxlinesD}
-\def\boxlinesD{\ifx\next\empty\else\expandafter\egroup\fi}
-
-\def\report{
- \typosize[11/13.2]
- \let\titfont=\chapfont
- \titskip=3ex
- \eoldef\author##1{\removelastskip\bigskip
- {\leftskip=0pt plus1fill \rightskip=\leftskip \it \noindent ##1\par}\nobreak\bigskip
- }
- \parindent=1.2em \_iindent=\parindent \_ttindent=\parindent
- \footline={\global\footline={\hss\_tenrm\thefontsize[10]\folio\hss}}
- \runningfnotes
-}
-\def\letter{
- \def\address{\vtop\bgroup\boxlines \parskip=0pt \let\par=\egroup}
- \def\subject{{\bf \mtext{subj}: }}
- \typosize[11/14]
- \parindent=0pt
- \parskip=\medskipamount
- \nopagenumbers
-}
-
\endinput
-
diff --git a/Master/texmf-dist/tex/luatex/optex/optex.ini b/Master/texmf-dist/tex/luatex/optex/optex.ini
index 802e6ccc2eb..370f60f0993 100644
--- a/Master/texmf-dist/tex/luatex/optex/optex.ini
+++ b/Master/texmf-dist/tex/luatex/optex/optex.ini
@@ -20,7 +20,7 @@
% OpTeX version
-\def\optexversion{Alpha 0.05 Feb 2020}
+\def\optexversion{Alpha 0.06 Mar 2020}
% Engine testing:
@@ -33,13 +33,12 @@
\message{This file can be used only for format initialisation, use luatex -ini^^J}
\endinput \fi
-% Basic \_codedecl / \_endcode pair:
+% Basic .opm syntax:
\let\_endcode =\endinput
-\def \_codedecl #1#2{%
- \ifx #1\undefined \message{#2^^J}%
- \else \expandafter \endinput \fi
-}
+\def \_codedecl #1#2{\message{#2^^J}}% information about .opm file
+\long\def\_doc#1\_cod#2 {} % skip documentation
+\let\_fin=\relax
% Initialization:
@@ -51,29 +50,39 @@
\input alloc.opm % allocators for registers
\input if-macros.opm % special \if-macros, \is-macros and loops
\input parameters.opm % parameters setting
-\input op-macros.opm % OpTeX useful macros
-\input plain-macros.opm % plainTeX macros
-\input fonts-preload.opm % preloaded Latin Modern fonts
-\input fonts-resize.opm % font resizing (low-level macros)
-\input fonts-select.opm % font selection system
-\input math-preload.opm % math fams CM + AMS preloaded
-\input math-macros.opm % basic macros for math plus mathchardefs
-\input math-unicode.opm % macros for loading UnicodeMath fonts
-\input fonts-opmac.opm % font managing macros from OPmac
-\input outlines.opm % PDF outlines
-\input pdfuni-string.opm % PDFunicode strings for outlines
+\input op-macros.opm % OpTeX useful macros (todo: doc)
+\input plain-macros.opm % plainTeX macros (todo:doc)
+\input fonts-preload.opm % preloaded Latin Modern fonts
+\input fonts-resize.opm % font resizing (low-level macros) (todo: texdoc)
+\input fonts-select.opm % font selection system (todo: texdoc)
+\input math-preload.opm % math fams CM + AMS preloaded (todo: doc)
+\input math-macros.opm % basic macros for math plus mathchardefs (todo: x)
+\input math-unicode.opm % macros for loading UnicodeMath fonts (todo: x)
+\input fonts-opmac.opm % font managing macros from OPmac (todo: doc)
\input maketoc.opm % maketoc
+\input outlines.opm % PDF outlines (todo: x)
+\input pdfuni-string.opm % PDFunicode strings for outlines (todo: x)
\input output.opm % output routine
-\input margins.opm % macros for margins setting
+\input margins.opm % macros for margins setting (todo: texdoc)
+\input colors.opm % colors
\input ref-file.opm % ref file
\input references.opm % references
\input hyperlinks.opm % hyperlinks
+\input sections.opm % titles, chapters, sections
+\input lists.opm % lists, \begitems, \enditems
\input verbatim.opm % verbatim
+\input graphics.opm % graphics
+\input table.opm % table macro
+\input multicolumns.opm % more columns by \begmulti ...\endmulti
+\input cite-bib.opm % Bibliography, \cite
+\input makeindex.opm % Make index and sorting
+\input fnotes.opm % \fnotes, \mnotes
+\input styles.opm % styles \report, \letter
\input logos.opm % standard logos
\input uni-lcuc.opm % Setting lccodes and uccodes for Unicode characters
-\input hyphen-lan.opm % initialization of hyphenation patterns
-\input opmac-rest.opm % TODO: needs to be re-implement
-\input csplain-params.opm % compatibility with CSplain
+\input hyphen-lan.opm % initialization of hyphenation patterns (todo: doc)
+\input languages.opm % languages
+\input others.opm % miscenaleous
\_everyjob = {%
\_message{This is OpTeX (Olsak's Plain TeX), version <\optexversion>^^J}%
@@ -88,7 +97,6 @@
TODO:
- re-implement macros from opmac-rest.opm
-- add unicode math support (from uni-math.tex from csplain)
- re-implement usebib, bib-style.opm
- add modules support (for example opmac-bib)
- write more and better documentation
diff --git a/Master/texmf-dist/tex/luatex/optex/others.opm b/Master/texmf-dist/tex/luatex/optex/others.opm
new file mode 100644
index 00000000000..7043a7589cb
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/others.opm
@@ -0,0 +1,73 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \uv {Miscenaleous <2020-01-23>}
+
+% You can write \useOpTeX at begining of your document
+
+\_let \useOpTeX = \_relax \_let \useoptex = \_relax
+
+% lastpage/totalpages
+
+\_def\_totalpages {\_openref\_ea\_lastpageA\_currpage}
+\_def\_lastpage {\_openref\_ea\_lastpageB\_currpage}
+\_def\_lastpageA #1#2{#1}
+\_def\_lastpageB #1#2{#2}
+\_def\_currpage {{0}{?}}
+\_public \lastpage \totalpages ;
+
+% for compatibility with csplain:
+
+\_chardef\clqq=8222 \_chardef\crqq=8220
+\_chardef\flqq=171 \_chardef\frqq=187
+\_chardef\promile=8240
+
+\_def\uv#1{\clqq#1\crqq}
+
+\_let\uslang=\enlang \_let\ehyph=\enlang
+\_let\chyph=\cslang \_let\shyph=\sklang
+\_let\csUnicode=\csPatt \_let\czUnicode=\csPatt \_let\skUnicode=\skPatt
+
+\_let \letfont = \_fontlet
+\_let \tenrm = \_tenrm \_let \tenbf = \_tenbf
+\_let \tenit = \_tenit \_let \tenbi = \_tenbi
+\_let \tentt = \_tentt
+
+
+% TikZ needs these control sequences:
+
+\ea\toksdef \csname toks@\endcsname=0
+\ea\let \csname voidb@x\endcsname=\_voidbox
+
+% another \tmpnum and \tmpdim are declared for user macros, no the same as private:
+
+\newcount\tmpnum % auxiliary count
+\newdimen\tmpdim % auxiliary dimen
+
+% We don't want to read opmac.tex unless \input opmac is specified:
+
+\def\OPmacversion{OpTeX}
+
+% Lorem ipsum. Usage \lipsum[3] or \lipsum[112-121], max=150
+
+\_def \_lipsum {%
+ {\_long\_def\ProvidesFile##1[##2]##3{\_ifx\_par##3\_relax\_else \_ea##3\_fi}\_tmpnum=0
+ \_def\NewLipsumPar{\_advance\_tmpnum by1
+ \_afterassignment\_negativermnm \_sxdef{lips:\_the\_tmpnum}}%
+ \_opinput {lipsum.ltd.tex}%
+ \_global\_let \_lipsum=\_reallipsum
+ }\_lipsum
+}
+\_def\_negativermnm{\_romannumeral-`\.}
+\_def\_reallipsum[#1]{\_lipsumA #1\_empty-\_empty\_end}
+\_def\_lipsumA #1-#2\_empty#3\_end{\_tmpnum=#1 \_edef\_tmp{\_ifx^#2^#1\_else#2\_fi}%
+ \_loop \_csname lips:\_the\_tmpnum\_endcsname \_par
+ \_ifnum\_tmpnum<\_tmp \_advance\_tmpnum by1 \_repeat
+}
+\def\lipsum {\_lipsum}
+\def\lorem {\_lipsum}
+
+\_endcode
+
+These codes are usable only after Unicode font is loaded using \fontfam.
+If you don't use Unicode fonts then more characters from Czech language stay
+unavailable (ř, ů, for example). See the notice in `fonts-preoad.opm`.
diff --git a/Master/texmf-dist/tex/luatex/optex/outlines.opm b/Master/texmf-dist/tex/luatex/optex/outlines.opm
index 5a5529a0858..fbad18cb206 100644
--- a/Master/texmf-dist/tex/luatex/optex/outlines.opm
+++ b/Master/texmf-dist/tex/luatex/optex/outlines.opm
@@ -1,6 +1,6 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \pdfunidef {PDFunicode strings for outlines <2019-05-21>}
+\_codedecl \pdfunidef {PDF outlines <2019-05-21>}
\_def\_outlines#1{\_pdfcatalog{/PageMode/UseOutlines}\_openref
\_ifx\_toclist\_empty
@@ -11,7 +11,8 @@
{\_let\_tocline=\_outlinesA
\_count0=0 \_count1=0 \_count2=0 \_count3=0 \_toclist % calculate numbers o childs
\_def\_outlinelevel{#1}\_let\_tocline=\_outlinesB
- \_tocrefnum=0 \_count0=0 \_count1=0 \_count2=0 \_count3=0 \_toclist}% create outlines
+ \_tocrefnum=0 \_count0=0 \_count1=0 \_count2=0 \_count3=0
+ \_toclist}% create outlines
\_fi
}
\_def\_outlinesA#1#2#3#4#5#6{%
@@ -38,15 +39,16 @@
\_tmpnum=\_trycs{_ol:\_the\_count0:\_the\_count1:\_the\_count2:\_the\_count3}{0}\_relax\_or
\_tmpnum = 0\_relax\_fi
\_pdfunidef\_tmp{#4}%
- \_outlinesC{#1}{toc:\_the\_tocrefnum}{\_ifnum#1<\_outlinelevel\_space\_else-\_fi}{\_tmpnum}{\_tmp}%
\_advance\_tocrefnum by1
+ \_outlinesC{#1}{toc:\_the\_tocrefnum}{\_ifnum#1<\_outlinelevel\_space\_else-\_fi}{\_tmpnum}{\_tmp}%
}
\_def\_outlinesC#1#2#3#4#5{\_pdfoutline goto name{#2} count #3#4{#5}\_relax}
\_newcount\_oulnum
\_def\_insertoutline#1{\_global\_advance\_oulnum by1
- \_pdfdest name{_oul:\_the\_oulnum} xyz\_relax
- \_pdfoutline goto name{_oul:\_the\_oulnum} count0 {#1}\_relax
+ \_pdfdest name{oul:\_the\_oulnum} xyz\_relax
+ \_pdfunidef\_tmp{#1}%
+ \_pdfoutline goto name{oul:\_the\_oulnum} count0 {\_tmp}\_relax
}
\_public
@@ -88,10 +90,10 @@ When second step is processed, then we only read the stored data about the
number of descentants. Ad we use it in `count` parameter of `\_pdfoutline`
primitive.
-For linking we use the same links as in TOC, i.e. the `_toc:\_the\_tocrefnum`
+For linking we use the same links as in TOC, i.e. the `toc:\_the\_tocrefnum`
labels are used.
`\insertoutline {<text>}` inserts one outline with zero direct descendants.
-It creates link destination of the type `_oul:<num>` into the document
+It creates link destination of the type `oul:<num>` into the document
(where `\isertoutline` is used) and the link itself is created too in the
outline.
diff --git a/Master/texmf-dist/tex/luatex/optex/output.opm b/Master/texmf-dist/tex/luatex/optex/output.opm
index a22afe68973..0bdefdb1ec6 100644
--- a/Master/texmf-dist/tex/luatex/optex/output.opm
+++ b/Master/texmf-dist/tex/luatex/optex/output.opm
@@ -2,35 +2,93 @@
\_codedecl \nopagenumbers {Output routine <2019-05-21>}
-\_output={\_begoutput \_optexoutput \_endoutput}
-\_def \_begoutput{\_prepoffsets} %
-\_def \_endoutput{}
+ \_doc -----------------------------
+ `\_optexouput` is default output routine. You can create another...
+ \_cod -----------------------------
-\_def\_optexoutput{%
- \_shipout\_vbox{%
+\_output={\_optexoutput}
+\_def \_optexoutput{\_begoutput \_shipout\_completepage \_endoutput}
+
+ \_doc -----------------------------
+ If you need another functionality implemented in output routine, you can
+ decalre `\addto\_begoutput{...}` or `\addto\_endoutput`. The settings
+ here is local in the `\output` group.
+
+ The `\_prepoffsets` can set `\hoffset` differently for left or right
+ page, it is re-defined by `\margins`, see \ref[margins] for more datail.
+
+ The `\_regmark` tokens list includes accumulated `#2` from `\regmacro`,
+ see section \ref[maketoc]. Logos and another macros are re-defined
+ here (locally) for their usage in headlines or footlines.
+ \endtt
+ \_cod -----------------------------
+
+\_def \_begoutput{\_incr\_gpageno
+ \_immediate\_wref\_Xpage{{\the\gpageno}{\_folio}}%
+ \_prepoffsets \_the\_regmark} %
+\_def \_endoutput{\_advancepageno
+ {\_globaldefs=1 \_the\_nextpages \_nextpages={}}%
+ \_ifnum\_outputpenalty>-20000 \_else\_dosupereject\_fi
+}
+\_def \_prepoffsets {}
+
+ \_doc -----------------------------
+ `\_gpageno` counts pages from one in whole document
+ \_cod -----------------------------
+
+\_newcount\_gpageno
+\_public \gpageno ;
+
+ \_doc -----------------------------
+ The `\_completepge` is similar what plain \TeX/ does in its oupput routine.
+ New is only `\_backgroundbox`. It is `\vbox` with zero height with its
+ contents (from `\pgbackground`) llaped down. It is shifted directly to the
+ left-upper corner of the paper.
+
+ The `\_ensureblack` sets the typesetting of its parameter locally to `\Black`
+ color. We needn't do this if colors are never used in the document. So,
+ default value of the `\_ensureblack` macro is empty. But first usage of
+ color macros in the document re-defines `\_ensureblack`.
+ \_cod -----------------------------
+
+\_def\_completepage{\_vbox{%
\_istoksempty \_pgbackground
- \_iffalse \_backgroundbox {\_the\_pgbackground}\_nointerlineskip \_fi
+ \_iffalse \_ensureblack{\_backgroundbox{\_the\_pgbackground}}\_nointerlineskip \_fi
\_ensureblack{\_makeheadline}%
- \_vbox to\_vsize {\_boxmaxdepth=\_maxdepth \_pagecontents}%
+ \_vbox to\_vsize {\_boxmaxdepth=\_maxdepth \_pagecontents}% \pagebody in plainTeX
\_ensureblack{\_makefootline}}%
- \_advancepageno
- \_ifnum\_outputpenalty>-20000 \_else\_dosupereject\_fi
}
\_def \_ensureblack #1{#1} % will be re-defined by color macros
-\_def \_pagedest {} % will be re-defined by macros for references
-\_def \_prepoffsets {} % will be re-defined by margins macros
\_def \_backgroundbox #1{\_moveleft\_hoffset\_vbox to0pt{\_kern-\voffset #1\_vss}}
+ \_doc -----------------------------
+ `\_makeheadline` creates `\vbox to0pt` with its contents (the `\headline`)
+ shifted by `\headlinedist` up.
+ \_cod -----------------------------
+
\_def\_makeheadline {\_istoksempty \_headline \_iffalse
- \_vbox to0pt{\_vskip-\_headlinedist
- \_line{\_copy\_strutbox \_the\_headline}\_vss}\_nointerlineskip
+ \_vbox to0pt{\_vss
+ \_baselineskip=\_headlinedist \_lineskiplimit=-\maxdimen
+ \_line{\_the\_headline}\_hbox{}}\_nointerlineskip
\_fi
}
+
+ \_doc -----------------------------
+ The `\_makefootline` appends the `\footline` to the page-body box. The
+ \_cod -----------------------------
+
\_def\_makefootline{\_istoksempty \_footline \_iffalse
- \_baselineskip=\_footlinedist
- \_lineskiplimit=-\maxdimen \_line{\_the\_footline}
+ \_baselineskip=\_footlinedist
+ \_lineskiplimit=-\maxdimen \_line{\_the\_footline}
\_fi
}
+
+ \_doc -----------------------------
+ The `\_pagecontents` is similar as in plain \TeX/. The only differnece is
+ that `\_pagedest` is inserted at the top of `\_pagecontents` and
+ `\_ensureblack` is applied to `\_topins` and `\_footins` material.
+ \_cod -----------------------------
+
\_def\_pagecontents{\_pagedest % destination of the page
\_ifvoid\_topins \_else \_ensureblack{\_unvbox\_topins}\_fi
\_dimen0=\dp255 \_unvbox255 % open up \box255
@@ -39,17 +97,13 @@
\_ensureblack{\_footnoterule \_unvbox\_footins}\fi
\_ifraggedbottom \kern-\_dimen0 \_vfil \_fi
}
+\_def \_pagedest {{\_def\_destheight{25pt}\_dest[pg:\_the\_gpageno]}}
\_def \_footnoterule {\kern-3pt \hrule width 2truein \kern 2.6pt }
-\_def\_pagebody{\_vbox to\_vsize{\_boxmaxdepth\_maxdepth \_pagecontents}}
- % unused, but for backward compatibility
-\_newdimen\_headlinedist \_headlinedist=22.5pt
-\_newdimen\_footlinedist \_footlinedist=24pt
-\_newtoks\_headline \_headline={}
-\_newtoks\_footline \_footline={\_hss\_truetenrm \_folio \_hss}
-\_newtoks\_pgbackground \_pgbackground={} % for page background
-\_public
- \headlinedist \footlinedist \pgbackground
- \makeheadline \makefootline \pagebody \headline \footline ;
+
+ \_doc -----------------------------
+ The macros used in the context of the output routine
+ from plain \TeX/ is defined here.
+ \_cod -----------------------------
\_countdef\_pageno=0 \_pageno=1 % first page is number 1
\_def \_folio {\_ifnum\_pageno<0 \_romannumeral-\_pageno \_else \_number\_pageno \_fi}
@@ -63,17 +117,25 @@
\_public
\pageno \folio \nopagenumbers \advancepageno \raggedbottom \normalbottom ;
+ \_doc -----------------------------
+ Macros for footnotes are the same as in plain \TeX. There is only one
+ difference: `\_vfootnote` is implemented as `\_opfootnote` with empty
+ parameter `#1`. This parameter should do a local settings inside
+ `\_footins` group and it does it when `\fnote` macro is used.
+ \_cod -----------------------------
+
\_newinsert\_footins
\_def \_footnote #1{\_let\_osf=\_empty % parameter #2 (the text) is read later
\_ifhmode \_edef\_osf{\_spacefactor\_the\_spacefactor}\/\_fi
#1\_osf\_vfootnote{#1}}
-\_def\_vfootnote#1{\_opfootnote{}{#1}}
+\_def\_vfootnote{\_opfootnote{}}
\_def \_opfootnote #1#2{\_insert\_footins\_bgroup
\_interlinepenalty=\_interfootnotelinepenalty
+ \_leftskip=0pt \_rightskip=0pt \_spaceskip=0pt \_xspaceskip=0pt \_relax
+ #1\_relax % local settings used by \fnote macro
\_splittopskip=\_ht\_strutbox % top baseline for broken footnotes
\_splitmaxdepth=\_dp\_strutbox \_floatingpenalty=20000
- \_leftskip=0pt \_rightskip=0pt \_spaceskip=0pt \_xspaceskip=0pt \_relax
- #1\_textindent{#2}\_footstrut
+ \_textindent{#2}\_footstrut
\_isnextchar \_bgroup {\_bgroup \_aftergroup\_vfootA \_let\_next=}{\_vfootB}%
}
\_def\_vfootA{\_strut\_egroup}
@@ -85,6 +147,10 @@
\_public
\footins \footnote \vfootnote \footstrut ;
+ \_doc -----------------------------
+ The `\_topins` macros are the same as in plain \TeX/.
+ \_cod -----------------------------
+
\_newinsert\_topins
\_newifi\_ifupage \_newifi\_ifumid
\_def \_topinsert {\_umidfalse \_upagefalse \_oins}
@@ -94,10 +160,10 @@
\_count\_topins=1000 % magnification factor (1 to 1)
\_dimen\_topins=\_maxdimen % no limit per page
\_def \_oins {\_par \_begingroup\_setbox0=\_vbox\_bgroup} % start a \_vbox
-\_def \_endinsert {\_egroup % finish the \_vbox
+\_def \_endinsert {\_par\_egroup % finish the \_vbox
\_ifumid \_dimen0=\_ht0 \_advance\_dimen0 by\_dp0 \_advance\_dimen0 by\_baselineskip
\_advance\_dimen0 by\_pagetotal \_advance\_dimen0 by-\_pageshrink
- \_ifdim\_dimen0>\_pagegoal \_umidfalse \_pagefalse \_fi \_fi
+ \_ifdim\_dimen0>\_pagegoal \_umidfalse \_upagefalse \_fi \_fi
\_ifumid \_bigskip \_box0 \_bigbreak
\_else \_insert \_topins {\_penalty100 % floating insertion
\_splittopskip=0pt
@@ -109,5 +175,57 @@
\_public
\topins \topinsert \midinsert \pageinsert \endinsert ;
+ \_doc -----------------------------
+ The `\draft` macro is an example of usage `\_pgbackground` to create
+ water color marks.
+ \_cod -----------------------------
+
+\_def\_draft{\_pgbackground={\_setdraftfont \_draftbox{\_draftfont DRAFT}}}
+
+\_def\_draftbox#1{\_setbox0=\_hbox{#1}%
+ \_kern.5\_vsize \_kern4.5\_wd0
+ \_hbox to0pt{\_kern.5\_hsize \_kern-1\_wd0
+ \_pdfsave \_pdfrotate{55}\_pdfscale{10}{10}%
+ \_hbox to0pt{\_localcolor\LightGrey \_box0\_hss}%
+ \_pdfrestore
+ \_hss}}
+\_def\_setdraftfont {%
+ \_ifx \_draftfont\_undefined
+ \_fontdef\_draftfont{\_setfontsize{at10pt}\_bf}%
+ \_global\_let\_draftfont=\_draftfont
+ \_fi
+}
+\_public \draft ;
+
\_endcode % -------------------------------------
+
+The output routine `\_optexoutput` is similar as in plain TeX. It does:
+
+\begitexm
+* `\begoutput` which does:
+ \begitems
+ * increments `\gpageno`,
+ * prints `\_Xpage{<gpageno>}{<pageno>}` to the `.ref` file (if `\openref` is active), sets `\hoffset` and
+ * calculates `\hoffset`,
+ * sets local meaning of macros for headlines/footlines (see `\_regmacro`).
+ \enditems
+* `\shipout\_completepage, which is `\vbox` of --
+ \begitems
+ * backrground box, if `\pgbackround` is non-empty,
+ * headline box, if `\headline` is nonempty,
+ * \vbox to\vsize of `\pagecontents` which cosnists of --
+ \begitems
+ * `\_pagedest`, the page destination `pg:<gpageno>` for hyperlinks is created here,
+ * `\_topins` box if non-empty (from `\topinsers`),
+ * `\box255` with completed vertical material from main vertical mode,
+ * `\_footnoterule` and `\_footins` box if nonempty (from `\fnote`, `\footnote`),
+ \enditems
+ * footline box, if `\footline` is nonempty
+ \enditems
+* `\endoutput` which does:
+ \begitems
+ * increments `\pageno` using `\_advancepageno`
+ * runs `\_dosupereject` if needed.
+ \enditems
+\enditems
diff --git a/Master/texmf-dist/tex/luatex/optex/parameters.opm b/Master/texmf-dist/tex/luatex/optex/parameters.opm
index 96fe5966911..23702de37ad 100644
--- a/Master/texmf-dist/tex/luatex/optex/parameters.opm
+++ b/Master/texmf-dist/tex/luatex/optex/parameters.opm
@@ -2,104 +2,62 @@
\_codedecl \normalbaselineskip {Parameter settings <2020-01-23>}
-% Settings like in plainTeX:
+ \_doc -----------------------------
+ The primitive registers with the same default value as in plain \TeX/ follow:
+ \_cod -----------------------------
-\_pretolerance=100
-\_tolerance=200 % INITEX sets this to 10000
+\_parindent=20pt % indentation of paragraphs
+\_pretolerance=100 % parameters used in paragraph breaking algorithm
+\_tolerance=200
\_hbadness=1000
\_vbadness=1000
-\_linepenalty=10
-\_hyphenpenalty=50
-\_exhyphenpenalty=50
-\_binoppenalty=700
-\_relpenalty=500
-\_clubpenalty=150
-\_widowpenalty=150
-\_displaywidowpenalty=50
-\_brokenpenalty=100
-\_predisplaypenalty=10000
-% \_postdisplaypenalty=0
-% \_interlinepenalty=0
-% \_floatingpenalty=0, set during \insert
-% \_outputpenalty=0, set before TeX enters \output
\_doublehyphendemerits=10000
\_finalhyphendemerits=5000
\_adjdemerits=10000
-% \_looseness=0, cleared by TeX after each paragraph
-% \_pausing=0
-% \_holdinginserts=0
-% \_tracingonline=0
-% \_tracingmacros=0
-% \_tracingstats=0
-% \_tracingparagraphs=0
-% \_tracingpages=0
-% \_tracingoutput=0
-\_tracinglostchars=1
-% \_tracingcommands=0
-% \_tracingrestores=0
-% \_language=0
\_uchyph=1
-% \_lefthyphenmin=2 \_righthyphenmin=3 set below
-% \_globaldefs=0
-% \_maxdeadcycles=25 % INITEX does this
-% \_hangafter=1 % INITEX does this, also TeX after each paragraph
-% \_fam=0
-% \_mag=1000 % INITEX does this
-% \_escapechar=`\\ % INITEX does this
\_defaulthyphenchar=`\-
\_defaultskewchar=-1
-% \_endlinechar=`\^^M % INITEX does this
-%\_newlinechar=-1
-\_delimiterfactor=901
-% \_time=now % TeX does this at beginning of job
-% \_day=now % TeX does this at beginning of job
-% \_month=now % TeX does this at beginning of job
-% \_year=now % TeX does this at beginning of job
-\_showboxbreadth=5
-\_showboxdepth=3
-\_errorcontextlines=5
-
\_hfuzz=0.1pt
\_vfuzz=0.1pt
\_overfullrule=5pt
-%\_hsize=6.5in
-%\_vsize=8.9in
-\_maxdepth=4pt
-\_splitmaxdepth=\_maxdimen
-\_boxmaxdepth=\_maxdimen
-% \_lineskiplimit=0pt, changed by \_normalbaselines
+\_linepenalty=10 % penalty between lines inside the paragraph
+\_hyphenpenalty=50 % when a word is bro-ken
+\_exhyphenpenalty=50 % when the hyphenmark is used explicitly
+\_binoppenalty=700 % between binary operators in math
+\_relpenalty=500 % between relations in math
+\_brokenpenalty=100 % after lines if they end by a broken word.
+\_displaywidowpenalty=50 % before last line of paragraph if display math follows
+\_predisplaypenalty=10000 % above display math
+\_postdisplaypenalty=0 % below display math
+\_delimiterfactor=901 % parameter for scaling delimiters
\_delimitershortfall=5pt
\_nulldelimiterspace=1.2pt
\_scriptspace=0.5pt
-% \_mathsurround=0pt
-% \_predisplaysize=0pt, set before TeX enters $$
-% \_displaywidth=0pt, set before TeX enters $$
-% \_displayindent=0pt, set before TeX enters $$
-\_parindent=20pt
-% \_hangindent=0pt, zeroed by TeX after each paragraph
-% \_hoffset=0pt
-% \_voffset=0pt
-
-% \_baselineskip=0pt, changed by \normalbaselines
-% \_lineskip=0pt, changed by \normalbaselines
+\_maxdepth=4pt
+\_splitmaxdepth=\_maxdimen
+\_boxmaxdepth=\_maxdimen
\_parskip=0pt plus 1pt
\_abovedisplayskip=12pt plus 3pt minus 9pt
\_abovedisplayshortskip=0pt plus 3pt
\_belowdisplayskip=12pt plus 3pt minus 9pt
\_belowdisplayshortskip=7pt plus 3pt minus 4pt
-% \_leftskip=0pt
-% \_rightskip=0pt
-\_topskip=10pt
-\_splittopskip=10pt
-% \_tabskip=0pt
-% \_spaceskip=0pt
-% \_xspaceskip=0pt
\_parfillskip=0pt plus 1fil
-
\_thinmuskip=3mu
\_medmuskip=4mu plus 2mu minus 4mu
\_thickmuskip=5mu plus 5mu
+ \_doc -----------------------------
+ Note that `\topskip` and `\splittopskip` are changed when first
+ `\typosize` sets the main values (default font size and `\baselineskip`).
+ \_cod -----------------------------
+
+\_topskip=10pt % top edge of page-box to first baseline distance
+\_splittopskip=10pt
+
+ \_doc -----------------------------
+ Declared registers used in plain \TeX/
+ \_cod -----------------------------
+
% We also define special registers that function like parameters:
\_newskip\_smallskipamount \_smallskipamount=3pt plus 1pt minus 1pt
\_newskip\_medskipamount \_medskipamount=6pt plus 2pt minus 2pt
@@ -118,24 +76,53 @@
\_def\_nonfrenchspacing{\_sfcode`\.=3000 \sfcode`\?=3000 \sfcode`\!=3000
\sfcode`\:=2000 \sfcode`\;=1500 \sfcode`\,=1250 }
\_public
- \normalbaselines \frenchspacing \nonfrenchspacing ;
+ \normalbaselines \frenchspacing \nonfrenchspacing
+ \smallskipamount \medskipamount \bigskipamount
+ \normalbaselineskip \normallineskip \normallineskiplimit
+ \jot \interdisplaylinepenalty \interfootnotelinepenalty ;
+
+ \_doc -----------------------------
+ Default `\baseline` setting is for 10pt fonts (like in plain \TeX/).
+ But `\typosize` and `\typoscale` re-declares it.
+ The `\nonfrenchspacing` is not set by default because
+ author of \OpTeX/ is living in Europe.
+ \_cod -----------------------------
\_normalbaselines % baseline setting,
- % \nonfrenchspacing is not set -- we are living in Europe
-% Different values than in plaiTeX:
+ \_doc -----------------------------
+ Different values than in plain \TeX/ have following primitive registers.
+ We prohibit orphans, set more information for tracing boxes, set page origin
+ to upper left corner of the paper (no at 1\,in, 1\,in coordinates)
+ and set default page dimensions as A4, no letter.
+ \_cod -----------------------------
+
+\_clubpenalty=10000 % after first line of paragraph
+\_widowpenalty=10000 % before last line of paragraph
+
+\_showboxbreadth=150 % for tracing boxes
+\_showboxdepth=7
+\_errorcontextlines=15
+\_tracinglostchars=2 % missing chracter warnings on terminal too
\_outputmode=1 % PDF ouput
-\_pdfvorigin=0pt
+\_pdfvorigin=0pt % orgin is exatly at left upper corner
\_pdfhorigin=0pt
-\_hoffset=20mm
-\_voffset=20mm
-\_hsize=170mm % 210mm (from A4 size) - 2*20mm (default margins)
-\_vsize=257mm % 297mm (from A4 size) - 2*20mm (default margins)
+\_hoffset=25mm % margins are 2.5cm, no 1in
+\_voffset=25mm
+\_hsize=160mm % 210mm (from A4 size) - 2*25mm (default margins)
+\_vsize=244mm % 297mm (from A4 size) - 2*25mm (default margins) -3mm baseline correction
\_pagewidth=210 true mm
\_pageheight=297 true mm
+ \_doc -----------------------------
+ If you insist on plain \TeX/ values of these parameters then you can
+ call the `\plaintexsetting` macro.
+ \_cod -----------------------------
+
\_def\_plaintexsetting{%
+ \_clubpenalty=150
+ \_widowpenalty=150
\_pdfvorigin=1in
\_pdfhorigin=1in
\_hoffset=0pt
@@ -145,23 +132,316 @@
\_pagewidth=8.5 true in
\_pageheight=11 true in
}
+\_public \plaintexsetting ;
+
+ \_doc -----------------------------
+ The second part of this section includes parameters declared and used
+ in \OpTeX/ macros.
+
+ The main principle how to configure \OpTeX/ is not to use only parameters.
+ A designer can copy macros from \OpTeX/ and re-define them as required.
+ This is a reason why we don't implement dozens of parameters,
+ but we keep \OpTeX/ macros relatively simple. Example: do you want
+ another design of section titles? Copy macros `\_printsec` and
+ `\_printsecc` from `sections.opm` file to your macro file and re-define them.
+
+ Notice for OPmac users: there is important difference: all "string-like"
+ parameters are token lists (OPmac uses macros for them). The reason of
+ this difference: if user sets parameter by unprotected control sequence,
+ an \OpTeX/ macro can read {\em the same data} using protected control sequence.
+ If user re-defines such unprotected control equance (because he/she does
+ know about it) then nothing bad happens.
+
+ 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 current directory (or somwhere in the \TeX/
+ system where \LuaTeX/ is able to find them). If you set 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 direcory and the image files are stored here.
+ \_cod -----------------------------
+
+\_newtoks\_picdir
+\_public \picdir ;
+
+ \_doc -----------------------------
+ You can control the dimesions of included images by
+ the parameters `\picwidth` (which is equivalent to `\picw`) and
+ `\picheight`. By default these parameters are set to zero: the native
+ dimension of the image is used. If only `\picwidth` has a nonzero value,
+ then this is width of the image (height is calulated automaticaly in
+ order to respect the aspect of the image). If only `\picheight` has
+ a nonzero value then height is given, 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 to set these
+ parameters locally in the group where `\inspic` is used in order to not
+ influence the dimensions of another 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.
+ \_cod -----------------------------
+
+\_newdimen\_picwidth \_picwidth=0pt \_let\picw=\_picwidth
+\_newdimen\_picheight \_picheight=0pt
+\_public \picwidth \picheight ;
+
+ \_doc -----------------------------
+ The `\everytt` is token list used in `\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 scanner of verbatm 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 `\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>}`.
+ You can set `\everyintt={\Red}` for example if you want in-line verbatim
+ in red color.
+ \_cod -----------------------------
+
+\_newtoks\_everytt
+\_newtoks\_everyintt
+\_public \everytt \everyintt ;
+
+ \_doc -----------------------------
+ The `\ttline` is used in `\begtt`...`\endtt` environment or in the code
+ printed by `\verbinput`. If `\ttline` is positive or zero, then the
+ verbatim code have numbered lines from `\ttline+1`. The `\ttline`
+ register is re-set to new value after a code piece is printed, so next
+ code pieces have numbered lines continuosly. If `\ttline=-1`, then
+ `\begtt`...`\endtt` lines are without numbers and `\verbinput` lines
+ shouws the line numbers of inputted file. If `\ttline<-1` then no line
+ numbers are printed.
+ \_cod -----------------------------
+
+\_newcount\_ttline \_ttline=-1 % last line number in \begtt...\endtt
+\_public \ttline ;
+
+ \_doc -----------------------------
+ The `\ttindent` gives default indentation of verbatim lines printed by
+ `\begtt`...`\endtt` or by `\verbintupt`.
+
+ The `\iindent` gives default indentations used in table of contents,
+ captions, lists, bib references,
+
+ It is strongly recommended to re-set this value if you set `\parindent`
+ to another value than plain \TeX/ default 20pt. A good typesetted
+ document should have the same dimension for all indentations, so
+ you should say `\ttindent=\parindent` and `\iindent=\parindent`.
+ \_cod -----------------------------
+
+\_newdimen\_ttindent \_ttindent=\_parindent % indentation in verbatim
+\_newdimen\_iindent \_iindent=\parindent
+\_public \ttindent \iindent ;
+
+ \_doc -----------------------------
+ The default item mark used between `\bgitems` and `\enditems` is bullet.
+ The `\everyitem` token list is applied in vertical mode
+ at the start of each item.
+ \_cod -----------------------------
+
+\_newtoks\_defaultitem \_defaultitem={$\_bullet$\_enspace}
+\_newtoks\_everyitem
+\_public \defaultitem \everyitem ;
+
+ \_doc -----------------------------
+ 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
+ `\colsep` decares the space between columns. If $n$ columns are specidied
+ then we have $n-1$ `\colseps` and $n$ columns in total `\hsize`. This
+ gives definite result of columns width.
+ \_cod ----------------------------
+
+\_newdimen\_colsep \_colsep=20pt % space between columns
+\_public \colsep ;
+
+ \_doc -----------------------------
+ Each line in the Table of contents is printed in a group.
+ The `\everytocline` tokens list is processed here before
+ the internal `\_tocl:<num>` macro which starts printig the line.
+ \_cod -----------------------------
+
+\_newtoks \_everytocline
+\_public \everytocline ;
+
+ \_doc -----------------------------
+ The `\bibtexhook` yokens list is used inside the group when `\usebib` command is
+ processed after style file is loaded and before printing bib-entries.
+ You can re-define a behavior of style file here or you can modify the
+ more declaration for printing (fonts, baselineskip, etc.) or you can
+ definie a specific macros used in your `.bib` file.
+ \_cod -----------------------------
+
+\_newtoks\_bibtexhook
+\_public \bibtexhook ;
+
+\_newtoks\_everycaptiont \_newtoks\_everycaptionf
+\_public \everycaptiont \everycaptionf ;
+
+ \_doc -----------------------------
+ The `\everyii` tokens list is used before `\noindent` for each
+ index item when priting index.
+ \_cod -----------------------------
+
+\_newtoks\_everyii
+\_public \everyii ;
+
+ \_doc -----------------------------
+ The `\_everyfnote` tokens list is used in the `\footinsert` group
+ in vertical mode before `\typoscale` and before
+ `\textindent{\_printfnotemark}` of the footnote text.
+ \_cod -----------------------------
+
+\_newtoks\_everyfnote
+\_public \everyfnote ;
+
+ \_doc -----------------------------
+ The `\everymnote` is used in the mnote group before `\noindent` which
+ immediately precedes marginal note text.
+ The `\mnotesize` is horizontal size of the marginal notes.
+ The `\mnoteindent` is horizontal space between body-text and marginal note.
+ The `\mnoteskip` is a dimen which denotes the vertical shift of mamrginal
+ note from its normal position. Positive value means shift up, negative
+ down. When marhinel note is printed the `\mnoteskip` register is set to
+ zero. Use it as an exception of marginal note position if the marginal
+ notes overlaps or they are put at bottom of the page.
+ \_cod -----------------------------
+
+\_newtoks\_everymnote
+\_newdimen\_mnotesize \_mnotesize=20mm % the width of the mnote paragraph
+\_newdimen\_mnoteindent \_mnoteindent=10pt % ditance between mnote and text
+\_newdimen\_mnoteskip
+\_public \everymnote \mnotesize \mnoteindent \mnoteskip ;
+
+ \_doc -----------------------------
+ The `\table` parameters follows. Note that `\thistable` register should
+ be used for giving an exceptino for only one `\table` which follows.
+ It should change locally other parameters of `\table`.
+ On the other hand `\everytab` is used after `\vbox` parameters
+ (`\baselineskip` etc.) are set, it means that this can be used to re-assign
+ such prameters.
+ \_cod -----------------------------
+
+\_newtoks\_everytable \_newtoks\_thistable
+\_newtoks\_tabiteml \_newtoks\_tabitemr \_newtoks\_tabstrut
+\_newdimen\_tablinespace \_newdimen\_vvkern \_newdimen\_hhkern
+\_everytable={} % code used after settings in \vbox before table processing
+\_thistable={} % code used when \vbox starts, is is removed after using it
+\_tabiteml={\enspace} % left material in each column
+\_tabitemr={\enspace} % right material in each column
+\_tablinespace=2pt % additional vertical space before/after horizontal rules
+\_vvkern=1pt % space between double vertical line and used in \frame
+\_hhkern=1pt % space between double horizontal line and used in \frame
+\_public \everytable \thistable \tabiteml \tabitemr \tabstrut \tablinespace \vvkern \hhkern ;
+
+ \_doc ----------------------------
+ You can declare `\tabstrut={}`, then normal baselineskip is used in the
+ table. We suppose that you don't use horizontal nor vertical lines in tables
+ with `\tabstrut={}` because this yeilds to bad result.
+ \_cod ----------------------------
+
+\_tabstrut={\strut} % strut which declares lines distance in the table
+
+ \_doc -----------------------------
+ The output routine uses token list `\headline` and `\footline` in the
+ same sense as in plain \TeX/. If they are non-empty then `\hfil` or `\hss`
+ must be here because they are used inside `\hbox to\hsize`.
+
+ Assume that page-body text can be typesetted in different sizes and
+ different fonts and we don't know in what font context the output routine
+ is invoked. So, it is strogly reccomended to declare fixed variants of
+ fonts at begining of your document. For example `\fontdef\rmfixed{\rm}`,
+ `\fontdef\itfixed{\it}`. Then use them in headline and footline:
+ \begtt
+ \headline={\itfixed Text of headline, section: \fistmark \hss}
+ \footline={\rmfixed \ifodd\pageno \hfill\fi \folio \hfil}
+ \endtt
+ \_cod -----------------------------
+
+\_newtoks\_headline \_headline={}
+\_newtoks\_footline \_footline={\_hss\_rmfixed \_folio \_hss}
+\_public \headline \footline ;
+
+ \_doc -----------------------------
+ The distance between the `\headline` and the top of the page-text
+ is controlled by `\headlinedist`. The distance between bottom of
+ page-text and `\footline` is `\footlinedist`. More precisely: baseline of
+ hedadline and baseline of first line in page-text have distance
+ `\headlinedist+\topskip`. baseline of the last line in page-text and
+ baseline of footline have distance `\footlinedist`.
+ Default values are inspired from plain \TeX/.
+ \_cod -----------------------------
+
+\_newdimen \_headlinedist \_headlinedist=14pt
+\_newdimen \_footlinedist \_footlinedist=24pt
+\_public \headlinedist \footlinedist ;
+
+ \_doc -----------------------------
+ The `\nextpages` token list can include settings which will be used at
+ next pages. It is processed at the end of output routine with
+ `\globaldefs=1` prefix. The `\nextpages` is reset to empty after
+ processing. Example of usage:
+ \begtt
+ \headline={} \nexptages={\headline={\fixedrm \firstmark \hfil}}
+ \endtt
+ This example sets current page with empty headline, but next pages have
+ non-empty headlines.
+ \_cod -----------------------------
+
+\_newtoks \_nextpages
+\_public \nextpages ;
+
+ \_doc -----------------------------
+ The `\pgpackground` token list can include macros which generate a
+ vertical list. It is used as page background. The top-left corner of such
+ `\vbox` is at the top-left corner of the paper. Example creates the
+ background of all pages yellow:
+ \begtt
+ \pgbackground={\Yellow \hrule height 0pt depth\pdfpageheight width\pdfpagewidth}
+ \endtt
+ \_cod -----------------------------
+
+\_newtoks \_pgbackground \_pgbackground={} % for page background
+\_public \pgbackground ;
-\_public
- \smallskipamount \medskipamount \bigskipamount
- \normalbaselineskip \normallineskip \normallineskiplimit
- \jot \interdisplaylinepenalty \interfootnotelinepenalty
- \plaintexsetting ;
\_endcode %----------------------------------------------------
+The behavior of document processing by \OpTeX/ is
+controlled by {\em parameters}. The parameters are
+\begitems
+* primitive registers used in build-in algorithms of \TeX/,
+* registers declared and used by \OpTeX/ macros.
+\enditems
+Both groups of registers have their type: number, dimension, skip, token
+list.
+
+The registers are represented by their names (control sequences). If an user
+re-defines such control sequence then the appropriate register exists
+steadily and build-in algorithms are using it without change. But user
+cannot access its value in such case. \OpTeX/ declares two control sequences
+for each register: prefixed and un-prefixed. \OpTeX/ macros use only
+prefixed variants of control sequernces. Users should use unprefixed variant
+with the same meaning and set or read values of registers using the
+unprefixed variant. If an user re-defines the unprefixed variant then
+\OpTeX/ macros still work without change.
+
+Examples mentioned here use unprefixed variants of register names but \OpTeX/
+macros use prefixed variants.
-The parameters are set to the same values as in plain\TeX, but there is one
-exception: The origin is at the top-left edge of the paper (this is more
-practical than the origin in positioned in non-SI units). The default
-typographical mirror is derived from A4 paper size and 20mm margins, not
-from letter paper size and 1in margins. The reason is that we are living in
-Europe where A4 paper is common in printers.
+There is only few parameters declared by \OpTeX/ macros. All are listed in
+this section. This is desired feature of the \OpteX/. If you want to do more
+changes wich cannot be controlled by parameters listed here then you can copy the
+appropriate \OpTeX/ macro to your macro file and you can completely re-define it.
-The macro `\plaintexsetting` removes the difference described above and sets
-the typographical mirror as in old plain\TeX.
diff --git a/Master/texmf-dist/tex/luatex/optex/pdfuni-string.opm b/Master/texmf-dist/tex/luatex/optex/pdfuni-string.opm
index 923a08fc86f..0aafcce27a0 100644
--- a/Master/texmf-dist/tex/luatex/optex/pdfuni-string.opm
+++ b/Master/texmf-dist/tex/luatex/optex/pdfuni-string.opm
@@ -13,8 +13,7 @@
\_def\_pdfunidef#1#2{%
\_begingroup
\_catcode`\\=12 \_let\\=\_bslash
- \_the\_pdfstringout % extra defnitions of logos etc.
- \_the\_outlineshook % user definitions
+ \_the\_regoul \_relax % \_regmacro alternatives of logos etc.
\_edef#1{#2}%
\_ea\_edef \_ea#1\_ea{\_ea\_removeoutmath #1$\_end$}% $x$ -> x
\_ea\_edef \_ea#1\_ea{\_ea\_removeoutbraces #1{\_end}}% {x} -> x
@@ -39,14 +38,12 @@
\_def\_removeoutbracesA #1{\_ifx\_end#1\_else #1\_ea\_removeoutbraces\_fi}
\_def\_removeoutmath #1$#2${#1\_ifx\_end#2\_else #2\_ea\_removeoutmath\_fi}
-\_newtoks \_pdfstringout \_newtoks \_outlineshook
-
-\_pdfstringout={\_let\em=\_empty \_let\rm=\_empty \_let\bf=\_empty
+\_regmacro {}{}{\_let\em=\_empty \_let\rm=\_empty \_let\bf=\_empty
\_let\it=\_empty \_let\bi=\_empty \_let\tt=\_empty \_let\/=\_empty
- \_let~=\_space \let\nl=\_space
+ \_let~=\_space
}
-\public \pdfunidef \outlineshook ;
+\public \pdfunidef ;
\_endcode % --------------------------------
diff --git a/Master/texmf-dist/tex/luatex/optex/plain-macros.opm b/Master/texmf-dist/tex/luatex/optex/plain-macros.opm
index 7402ff5cd5e..a9e4f2de1b7 100644
--- a/Master/texmf-dist/tex/luatex/optex/plain-macros.opm
+++ b/Master/texmf-dist/tex/luatex/optex/plain-macros.opm
@@ -157,7 +157,8 @@
\def\_{\_ifmmode \_kern.06em \_vbox{\hrule width.3em}\_else _\fi} % obsolete
\_def\dag{\_errmessage{\_usedirectly †}}
\_def\ddag{\_errmessage{\_usedirectly ‡}}
-\_def\copyright{\_errmessage{\_usedirectly ©}}
+%\_def\copyright{\_errmessage{\_usedirectly ©}}
+\_def\copyright{©}
%\_def\Orb{\_mathhexbox20D} % obsolete (part of Copyright)
%\_def\P{\_mathhexbox27B} % obsolete
@@ -262,8 +263,7 @@
\_pretolerance=-1 \tolerance=-1 \hbadness=0 \showboxdepth=0 \ #1}}
\_def \_bye {\_par \_vfill \_supereject \_end}
-\_public
- \bye ;
+\_public \bye ;
\_endcode % -------------------------------------
diff --git a/Master/texmf-dist/tex/luatex/optex/prefixed.opm b/Master/texmf-dist/tex/luatex/optex/prefixed.opm
index c545c29f1ad..06c46ee65db 100644
--- a/Master/texmf-dist/tex/luatex/optex/prefixed.opm
+++ b/Master/texmf-dist/tex/luatex/optex/prefixed.opm
@@ -2,10 +2,12 @@
\_codedecl \public {Prefixing and code syntax <2020-02-14>}
-% all TeX82 primitives have alternative control sequence \_hbox \_string, ...
-\let\_directlua = \directlua
+ \_doc ---------
+ All TeX82 primitives have alternative control sequence \_hbox \_string, ...
+ \_cod ---------
+\let\_directlua = \directlua
\_directlua {
% enable all TeX primitives with _ prefix
tex.enableprimitives('_', tex.extraprimitives('tex'))
@@ -15,6 +17,19 @@
tex.enableprimitives('_', tex.extraprimitives())
}
+ \_doc ------------------
+ `\public <sequence> <sequence> ... ;` does
+ `\let \<sequence> = \_<sequence>` for all sequences.
+
+ `\private <sequence> <sequence> ...;` does
+ `\let \_<sequence> = \<sequence>` for all sequences.
+
+ The auxiliary macro `\xargs <what> <sequece> <sequence> ... ;`
+ does `<what><sequence>` for each sequences.
+
+ `\_ea` is useful shotcut for `\expandafter`.
+ \_cod -----------------
+
\_let\_ea =\_expandafter % usefull shortcut
\_long\_def \_xargs #1#2{\_ifx #2;\_else \_ea#1\_ea#2\_ea\_xargs \_ea #1\_fi}
@@ -25,6 +40,13 @@
\_def \_private {\_xargs \_privateA}
\_def \_privateA #1{\_ea\_let \_csname _\_csstring #1\_endcsname =#1}
+ \_doc -----------------------
+ Each `.opm` file should begin with `\_codedecl \macro {<info>}`.
+ If `\macro` is defined already then the `\endpinput` protects to read
+ such file more than one times. Else the <info> is printed to terminal
+ and file is read.
+ \_cod \_fin ------------------
+
\_def \_codedecl #1#2{%
\_ifx #1\_undefined \_wterm{#2}%
\_else \_expandafter \_endinput \_fi
@@ -32,6 +54,7 @@
\_def \_wterm {\_immediate \_write16 }
\_public \public \private \xargs \ea \wterm ;
+\_private \optexversion ;
\_endcode %----------------------------------------------------
diff --git a/Master/texmf-dist/tex/luatex/optex/ref-file.opm b/Master/texmf-dist/tex/luatex/optex/ref-file.opm
index e16e89ab7b5..ba76563ca0a 100644
--- a/Master/texmf-dist/tex/luatex/optex/ref-file.opm
+++ b/Master/texmf-dist/tex/luatex/optex/ref-file.opm
@@ -1,19 +1,39 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \_openref {references <2020-02-14>}
+\_codedecl \_openref {File for references <2020-02-14>}
-\_newwrite\_reffile
+ \_doc --------------------------
+ The `\_inputref` macro is used in `\everyjob`. It reads `\jobname.ref` file
+ if it exists. After the file is read then it is removed and opened to write
+ a new contents to this file.
+ \_cod --------------------------
-\_def\_wrefrelax#1#2{}
-\_let\_wref=\_wrefrelax
+\_newwrite\_reffile
\_def\_inputref {%
\_isfile{\_jobname.ref}\_iftrue
- \input {\jobname.ref}
- \_fnotenum=0 \_mnotenum=0
+ \_input {\jobname.ref}
+ \_gfnotenum=0 \_lfnotenum=0 \_mnotenum=0
\_openrefA{\_string\inputref}%
\_fi
}
+
+ \_doc --------------------------
+ If the file does not exists then it is not created by default. It means that if you
+ process a document without any forward references then no `\jobname.ref`
+ file is created because it is unusable. The `\_wref` macro is dummy in
+ such case.
+ \_cod --------------------------
+
+\_def\_wrefrelax#1#2{}
+\_let\_wref=\_wrefrelax
+
+ \_doc ---------------------
+ If a macro needs to ceate and to use `.ref` file then such file must be created by
+ `\_openref`. When the file is created (using internal `\_openrefA`) then
+ `\_opneref` destroys itself, because we need not to open the file again.
+ \_cod ---------------------
+
\_def\_openref {%
\_ifx \_wref\_wrefrelax \_openrefA{\_string\openref}\_fi
\_gdef\_openref{}%
@@ -21,41 +41,75 @@
\_def\_openrefA #1{%
\_immediate\_openout\_reffile="\_jobname.ref"\_relax
\_gdef\_wref ##1##2{\_write\_reffile{\_string##1##2}}%
- \_immediate\_write\_reffile {\_pcent\_pcent\_space OPTeX - REF file (#1)}%
- \_immediate\_wref \_Xrefversion{{\_REFversion}}%
+ \_immediate\_write\_reffile {\_pcent\_pcent\_space OPTeX <\_optexversion> - REF file (#1)}%
+ \_immediate\_wref \Xrefversion{{\_REFversion}}%
}
-\_def\_REFversion{3}
-\_def\_Xrefversion#1{\_ifnum #1=\_REFversion\_relax \_else \_endinput \_fi}
-\_def\_Xprocess#1{#1}
-\_public \Xrefversion ;
+ \_doc ----------------------
+ We are using a convention that the macros used in `.ref` file are named
+ `\_X<foo>`. If there is a new wersion of \OpTeX/ with different collection
+ of such macros then we don't want to read the `.ref` files produced by an
+ old version of \OpTeX/ or by OPmac. So first line of `.ref` line is in
+ the form
+ \begtt
+ \Xrefversion{<version>}
+ \endtt
+ We can check the version compatibility by this macro.
+ Because OPmac does not understand `\_Xrefversion` we use
+ `\Xrefversion` (different form OPmac) here.
+ \_cod ----------------------
-\_endcode % -------------------------------------
+\_def\_REFversion{3} % actual version of .ref files
+\_def\_Xrefversion#1{\_ifnum #1=\_REFversion\_relax \_else \_endinput \_fi}
+\_public \Xrefversion ; % we want to ignore .ref files generated by OPmac
-The `\_inputref` macro is used in `\everyjob`. It reads `\jobname.ref` file
-if it exists. After the file is read then it is removed and opened to write
-a new contents to this file.
+ \_doc -----------------------
+ You cannot define your special `.ref` macos before `.ref` file is read
+ because it is read in `\everyjob`. But you can define such macros using
+ `\refdecl{<definitions of your ref macros>}`.
+ This command sends to `.ref` file your <definitions of your ref macros>
+ immediately. Next lines in `.ref` file should include our macros.
+
+ We must read <definition of your ref macros> when catcode of `#` is 12
+ because we needn't to duplicate each `#` in the `.ref` file.
+ \_cod \_fin -----------------
-If the file does not exists then it is not created. It means that if you
-process a document without any forward references then no `\jobname.ref`
-file is created because it is unusable. The `\_wref` macro is unusable in
-such case.
+\_def\_refdecl{\bgroup \catcode`\#=12 \_refdeclA}
+\_def\_refdeclA #1{\egroup\_openref
+ \_immediate\_write\_reffile {\_pcent\_space \_string \refdecl:}%
+ \_immediate\_write\_reffile {\_detokenize{#1}}%
+}
+\_public \refdecl ;
-If a macro needs to ceate and to use REF file then such file must be created by
-`\_openref`. When the file is created (using internal `\_openrefA`) then
-`\_opneref` destroys itself, because we need not to open the file again.
+\_endcode % ================================================
-We are using a convention that the macros used in REF file are named
-`\_X<foo>`. If there is a new wersion of \OpTeX/ with different collection
-of such macros then we don't want to read the REF files produced by an
-old version of \OpTeX/. So first line of REF line is in the form
-\begtt
-\_Xrefversion{<version>}
-\endtt
+The REF file looks like:
-We can check the verion compatibility by this macro.
+\begtt
+\Xrefversion{<ref-version>}
+\_Xpage{<gpageno>}{<pageno>}
+\_Xtoc{<level>}{<type>}{<text>}{<title>}
+\_Xlabel{<label>}{<text>}
+\_Xlabel{<label>}{<text>}
+...
+\_Xpage{<gpageno>}{<pageno>}
+\_Xlabel{<label>}{<text>}
+...
+\endtt
-User can write the `\_openref\_wref\_Xpocess{<comething>}` at beginning of
-the document if he/she needs to define a macros used in REF file later.
+where <gpageno> is internal page number numbered from one and <pageno> is
+a page number used in pagination. Each page begins with `\_Xpage`.
+The <label> is <label> used by user in `\label[<label>]` and <text> is a
+<text> which should be referenced (the number of section or table, for
+example `2.3.14`). The <title> is a tile of the chapter (<level>=1,
+<type>=`chap`), section (<level>=2, <type>=`sec`), subsection
+(<level>=3, <type>=`secc`). The `\_Xpage` is written at begining of each
+page, the `\_Xtoc` is written when chapter or section or subsection title
+exists on the page and `\_Xlabel` when labeled object prefixed by
+`\label[<label>]` exists on the page.
+The `.ref` file is read when the processing of the document starts using
+`\everyjob`. It is removed and opened to writting immediately when it is read.
+But the `.ref` file should be missing. If none references are needed in the
+document then `.ref` file is not created.
diff --git a/Master/texmf-dist/tex/luatex/optex/references.opm b/Master/texmf-dist/tex/luatex/optex/references.opm
index 8eb1fba2e27..37d06982141 100644
--- a/Master/texmf-dist/tex/luatex/optex/references.opm
+++ b/Master/texmf-dist/tex/luatex/optex/references.opm
@@ -1,23 +1,32 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \ref {references <2020-02-22>}
+\_codedecl \ref {References <2020-02-22>}
-%> \_Xpage
+ \_doc ----------------------------
+ `\_Xpage {<gpageno>}{<pageno>}` saves the patameter pair into `\_currpage`
+ and actualizes `\lastpage`. Resets `\_lfnotenum` used if footnotes are
+ numbered from one at each page.
+ \_cod ----------------------------
-\_newcount\_lastpage \_lastpage=0 % the last page of the document
-\_newcount\_fnotenumlocal
-\_def\_Xpage#1#2{\_def\_currpage{{#1}{#2}}\_lastpage=#2 \_fnotenumlocal=0 }
+\_def\_Xpage#1#2{\_def\_currpage{{#1}{#2}}\_lfnotenum=0 }
-%> \_Xlabel
+ \_doc ----------------------------
+ `\_Xlabel {<label>}{<text>}` saves <text> to `\_lab:<label>` and saves
+ `[<gpageno>]{<pageno>}` to `\_pgref:<label>`.
+ \_cod ----------------------------
\_def\_Xlabel#1#2{\_sdef{_lab:#1}{#2}\_sxdef{_pgref:#1}{\_ea\_bracketspg\_currpage}}
\_def\_bracketspg#1#2{[pg:#1]{#2}}
-%> \label \wlabel
+ \_doc ----------------------------
+ `\label[<label>]` saves decalred labet to `\_lastlabel` and `\wlabel{<text>}`
+ uses `\lastlabel` and activates `\wref\_Xlabel{<label>}{<text>}`.
+ \_cod ----------------------------
-\_def\_label[#1]{\_isdefined{l0:#1}%
- \_iftrue \_opwarning{duplicated label [#1], ignored}\_else \_xdef\_lastlabel{#1}\_fi
- \_ignorespaces
+\_def\_label[#1]{\_isempty{#1}\_iftrue \_global\_let \_lastlabel=\_undefined
+ \_else \_isdefined{l0:#1}%
+ \_iftrue \_opwarning{duplicated label [#1], ignored}\_else \_xdef\_lastlabel{#1}\_fi
+ \_fi \_ignorespaces
}
\_def\_wlabel#1{%
\_ifx\_lastlabel\_undefined \_else
@@ -29,7 +38,16 @@
\_fi
}
-%> \ref \pgref
+ \_doc ----------------------------
+ `\ref[<label>]` uses saved `\_lab:<label>` and prints (linked) <text>.
+ If the reference is backwarded then we know `\lab:<label>` without any need
+ to read REF file. On the other hand, if the reference is forwarded, then we
+ doesn't know `\_lab:<label>` in first run of \TeX/ and we print warning and
+ do `\_openref`.
+
+ `\pgref[<label>]` uses `{<gpageno>}{<pageno>}` from `\_pgref:<label>` and
+ prints (linked) <pageno> using `\_ilink` macro.
+ \_cod ----------------------------
\_def\_ref[#1]{\_isdefined{_lab:#1}%
\_iftrue \_ilink[ref:#1]{\_csname _lab:#1\_endcsname}%
@@ -41,73 +59,14 @@
\_else ??\_opwarning{pg-label [#1] unknown. Try to TeX me again}\_openref
\_fi
}
-
-%> \begoutput
-
-\addto\_begoutput{%
- \_incr \_gpageno % global pageno from one independent on pagination
- \immediate\_wref\_Xpage{{\the\gpageno}{\_the\_pageno}}%
-}
-
-\_newcount\_gpageno
-
\_public
- \label \wlabel \ref \pgref \gpageno ;
-
-
-\_endcode % -------------------------------------
-
-The REF file looks like:
-
-\begtt
-\_Xpage{<gpageno>}{<pageno>}
-\_Xlabel{<label>}{<text>}
-\_Xlabel{<label>}{<text>}
-\_Xlabel{<label>}{<text>}
-...
-\_Xpage{<gpageno>}{<pageno>}
-\_Xlabel{<label>}{<text>}
-...
-\endtt
-
-where <gpageno> is internal page number numbered from one and <pageno> is
-a page number used in pagination. Each page begins with `\_Xpage`.
-The <label> is <label> used by user in `\label[<label>]` and <text> is a
-<text> which shoul be referenced (the number of section or table, for
-example).
-
-The REF file is scanned at the begining of the document using `\inputref`
-invoked by `\everyjob`.
-
-\%> \_Xpage
-
-`\_Xpage {<gpageno>}{<pageno>}` saves the patameter pair into `\_currpage`
-and actualizes `\lastpage`. Resets `\_fnotenumlocal` used if footnotes are
-numbered from one at each page.
-
-\%> \_Xlabel
-
-`\_Xlabel {<label>}{<text>}` saves <text> to `\_lab:<label>` nad saves
-`[<gpageno>]{<pageno>}` to `\_pgref:<label>`.
-
-\%> \label \wlabel
-
-`\label[<label>]` saves decalred labet to `\_lastlabel` and `\wlabel{<text>}`
-uses `\lastlabel` and activetes `\wref\_Xlabel{<label>}{<text>}`.
-
-\%> \ref \pgref
-
-`\ref[<label>]` uses saved `\_lab:<label>` and prints (linked) <text>.
-If the reference is backwarded then we know `\lab:<label>` without any need
-to read REF file. On the other hand, if the reference is forwarded, then we
-doesn't know `\_lab:<label>` in first run of \TeX/ and we print warning and
-do `\_openref`.
+ \label \wlabel \ref \pgref ;
-`\pgref[<label>]` uses `{<gpageno>}{<pageno>}` from `\_pgref:<label>` and
-prints (linked) <pageno> using `\_ilink` macro.
+\_endcode %------------------------------------------
-\%> \begoutput
-We add to `\_begoutput` incrementing `<gpageno>` and writting
-`\_Xpage {<gpageno>}{<pageno>}`.
+If the references are \"forward" (i.~e. the `\ref` is used first, the destination
+is created later), or if the reference text is page number, we must read
+`.ref` file first in order to get appropriate information.
+See section \ref[ref-file] for more information about `.ref` file concept.
diff --git a/Master/texmf-dist/tex/luatex/optex/sections.opm b/Master/texmf-dist/tex/luatex/optex/sections.opm
new file mode 100644
index 00000000000..e528680d422
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/sections.opm
@@ -0,0 +1,355 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \chap {Titles, chapters, sections, subsections <2020-03-02>}
+
+ \_doc ---------------------------
+ We are using scaled fonts for titles. They are scaled from main fonts size
+ of the document, which is declared by first `\typosize[<fo-size>/<b-size>]`
+ command.
+ \_cod ---------------------------
+
+\_def \_titfont {\_scalemain\_boldify\_typoscale[\_magstep4/\_magstep5]}
+\_def \_chapfont {\_scalemain\_boldify\_typoscale[\_magstep3/\_magstep3]}
+\_def \_secfont {\_scalemain\_boldify\_typoscale[\_magstep2/\_magstep2]}
+\_def \_seccfont {\_scalemain\_boldify\_typoscale[\_magstep1/\_magstep1]}
+
+ \_doc ---------------------------
+ The `\tit` macro is defined by `\eoldef`, it means that the parameter is
+ separated by end of line. The macros `\chap`, `\sec` and `\secc` use
+ `\eoldef` too.
+ \_cod ---------------------------
+
+\_eoldef\_tit #1{\_vglue\_titskip
+ {\_leftskip=0pt plus1fill \_rightskip=\_leftskip % centering
+ \_titfont \_noindent #1\_par}%
+ \_nobreak\_bigskip
+}
+\_public \tit ;
+
+ \_doc ---------------------------
+ You can re-define `\_printchap`, `\_printsec` or `\_printsecc` macros if
+ another design of section titles is needed. These macros gets the <title>
+ text in its parameter. The common recommendations for these macros are:
+ \begitems
+ * Use `\_abovetitle{<penaltyA>}{<skipA>}` and `\_belowtitle{<skipB>}
+ for inserting vertical material above and below the section title.
+ The arguments of these macros are normally used, i.e. \_abovetitle`
+ inserts <penaltyA><skipA> and `\_belowtitle` inserts <skipB>.
+ But there is an
+ exception: if `\_belowtitle{<skip>}` is immediately followed by next
+ `\_abovetitle{<penalty>}` (for example section title is immediately followed by
+ subsection title), then only <skipA> is generated, i.e.
+ <skipB><penaltyA><skipA> is reduced only to <skipA>
+ The reason of such behavior: we don't want to duplicate vertical skip
+ and we don't want to use negative penalty in such cases.
+ Moreower, `\_abovetitle{<penaltyA>}{<skipA>}` takes previous whatever
+ vertical skip (other than from `\_belowtitle`) and generates only
+ greater from this pair of skips. I.e. <whatever-skip><penaltyA><skipA>
+ is reduced to $<penaltyA>\max(<whatever-skip><skipA>)$.
+ The reason of such behavior: we don't want to
+ duplicate vertical skips (from `\_belowlistskip`, for example) above the title.
+ * Use `\_printrefnum[<pre>@<post>]` in horizontal mode. It prints
+ <pre><ref-num><post>. The <ref-num> is `\thechapnum` or `\thesecnum`
+ or `\theseccnum` depending on what type o title is processed.
+ If `\nonum` prefix is used then `\_printrefnum` prints nothing.
+ The macro `\_printrefnum` does more work: it creates destination of hyperlinks
+ (if `\hyperlinks{}{}` is used) and saves references from label (if
+ `\label[<label>]` precedes) and saves references for table of contents
+ (if `\maketoc` is used).
+ * Use `\nbpar` for closing the paragraph for printing title. This
+ command inserts `\_nobreak` between each line of such paragraph, so
+ the title cannot be broken to more pages.
+ \enditems
+ \_cod ---------------------------
+
+\_def\_printchap #1{\_vfill\_supereject
+ {\_chapfont \_noindent \_mtext{chap} \_printrefnum[@]\_par
+ \_nobreak\_smallskip
+ \_noindent \_raggedright #1\_nbpar}\_mark{}%
+ \_nobreak \_belowtitle{\_medskip}%
+ \_firstnoindent
+}
+\_def\_printsec#1{\_par
+ \_abovetitle{\_penalty-400}\_bigskip
+ {\_secfont \_noindent \_raggedright \_printrefnum[@\_quad]#1\_nbpar}\_insertmark{#1}%
+ \_nobreak \_belowtitle{\_medskip}%
+ \_firstnoindent
+}
+\_def\_printsecc#1{\_par
+ \_abovetitle{\_penalty-200}\_medskip
+ {\_seccfont \_noindent \_raggedright \_printrefnum[@\_quad]#1\_nbpar}%
+ \_nobreak \_belowtitle{\_medskip}%
+ \_firstnoindent
+}
+
+ \_doc --------------------------
+ The `\_sectionlevel` is the level of the printed section:
+ \begitems
+ * `\_sectionlevel=0` -- reserved for parts of the book (unused by default)
+ * `\_sectionlevel=1` -- chapters (used in `\chap`)
+ * `\_sectionlevel=2` -- sections (used in `\sec`)
+ * `\_sectionlevel=3` -- subsections (used in `\secc`)
+ * `\_sectionlevel=4` -- subsubsections (unused by default)
+ \enditems
+ \_cod --------------------------
+
+\_newcount\_sectionlevel
+\_def \_secinfo {\_ifcase \_sectionlevel
+ part\_or chap\_or sec\_or secc\_or seccc\_fi
+}
+
+ \_doc --------------------------
+ The `\_chapx` initializes counters used in chapters,
+ the `\_secx` initializes counters in sections
+ and `\_seccx` initializes counters in subsections.
+ If you have another concept of numbering objects used in your
+ document, you can re-define these macros. All settings here are global
+ because it is used by `{\_globaldefs=1 \_chapx}`.
+
+ Default concept: Tables, figuers and display maths are numbered
+ from one in each section -- subsetions doesn't reset these counters.
+
+ The `\_the*` macros includes the format of numbers used when the object
+ is printing. If chapter is never used in the document then `\_chapnum=0`
+ and `\_othe\_chapnum.` expands to empty. Sections have numbers <num> and
+ 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>.
+
+ If you have more types of numbered objects in your document then you can
+ declare appropriate counters and do `\addto\_chapx{\yourcounter=0 }`
+ for example.
+ \_cod --------------------------
+
+\_newcount \_chapnum % chapters
+\_newcount \_secnum % sections
+\_newcount \_seccnum % subsections
+\_newcount \_tnum % table numbers
+\_newcount \_fnum % figure numbers
+\_newcount \_dnum % numbered display maths
+
+\_def \_chapx {\_incr\_chapnum \_secnum=0 \_seccnum=0 \_tnum=0 \_fnum=0 \_dnum=0 \_lfnotenum=0 }
+\_def \_secx {\_incr\_secnum \_seccnum=0 \_tnum=0 \_fnum=0 \_dnum=0 }
+\_def \_seccx {\_incr\_seccnum }
+
+\_def \_thechapnum {\_the\_chapnum}
+\_def \_thesecnum {\_othe\_chapnum.\_the\_secnum}
+\_def \_theseccnum {\_othe\_chapnum.\_the\_secnum.\_the\_seccnum}
+\_def \_thetnum {\_othe\_chapnum.\_the\_secnum.\_the\_tnum}
+\_def \_thefnum {\_othe\_chapnum.\_the\_secnum.\_the\_fnum}
+\_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
+ internal `\_ifnotoc` and `\_ifnonum`.
+ \_cod ----------------------------
+
+\_newifi \_ifnotoc \_notocfalse \_def\_notoc {\_global\_notoctrue}
+\_newifi \_ifnonum \_nonumfalse \_def\_nonum {\_global\_nonumtrue}
+\_def \_resetnonumnotoc{\_global\_notocfalse \_global\_nonumfalse}
+\_public \notoc \nonum ;
+
+ \_doc ----------------------------
+ The `\chap`, `\sec` and `\secc` macros are implemnted here.
+ The `\_inchap`, `\_insec` and `\_insecc` macros does the real work,
+ First, we read the optional parameter `[<label>]`, if it exists.
+ \_cod ----------------------------
+
+\_optdef\_chap[]{\_trylabel \_inchap}
+\_optdef\_sec []{\_trylabel \_insec}
+\_optdef\_secc[]{\_trylabel \_insecc}
+\_def\_trylabel{\_istoksempty\_opt\_iffalse \_label[\_the\_opt]\_fi}
+
+\_eoldef\_inchap #1{\_par \_sectionlevel=1
+ \_def \_savedtitle {#1}% saved to .ref file
+ \_ifnonum \_else {\_globaldefs=1 \_chapx}\_fi
+ \_edef \_therefnum {\_ifnonum \_space \_else \_thechapnum \_fi}%
+ \_printchap{#1}%
+ \_resetnonumnotoc
+}
+\_eoldef\_insec #1{\_par \_sectionlevel=2
+ \_def \_savedtitle {#1}% saved to .ref file
+ \_ifnonum \_else {\_globaldefs=1 \_secx}\_fi
+ \_edef \_therefnum {\_ifnonum \_space \_else \_thesecnum \_fi}%
+ \_printsec{#1}%
+ \_resetnonumnotoc
+}
+\_eoldef\_insecc #1{\_par \_sectionlevel=3
+ \_def \_savedtitle {#1}% saved to .ref file
+ \_ifnonum \_else {\_globaldefs=1 \_seccx}\_fi
+ \_edef \_therefnum {\_ifnonum \_space \_else \_theseccnum \_fi}%
+ \_printsecc{#1}%
+ \_resetnonumnotoc
+}
+\_public \chap \sec \secc ;
+
+ \_doc ----------------------------
+ The `\_printrefnum[<pre>@<post>]` macro is used in `\_print*` macros.
+ 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 occurrs.
+ \_cod ----------------------------
+
+\_def \_printrefnum [#1@#2]{\_leavevmode % we must be in horizontal mode
+ \_ifnonum \_else #1\_therefnum #2\_fi
+ \_wlabel \_therefnum % references, if `\label[<label>]` is declared
+ \_ifnotoc \_else \_incr \_tocrefnum
+ \_dest[toc:\_the\_tocrefnum]%
+ \_wtotoc{\_the\_sectionlevel}{\_secinfo}%
+ {\_therefnum}{\_detokenize\_ea{\_savedtitle}}%
+ \_fi
+}
+\_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 -----------------------------
+ The `\_abovetitle{<penaltyA>}{<skipA>}` and `\_belowtitle{<skipB>}` pair
+ communicates using a special penalty 11333 in vertical mode.
+ The `\_belowtitle` puts the vertical skip (its value is saved in
+ `\_savedtitleskip`) followed by this special penalty.
+ The `\_abovetitle` reads `\lastpenalty` and if it has this special value
+ then it removes the skip used before and dont use the parameter.
+ The `\abovetitle` creates <skipA> only if whatever previous skip is less
+ or equal than <skipA>. We must save <whatever-skip>, remove it,
+ create <penaltyA> (if belowtitle does not preceded) and create
+ <whatever-skip> or <skipA> depending on what is greater.
+ The amount of <skipA> is measured using `\setbox0=\vbox`.
+ \_cod -----------------------------
+
+\_newskip \_savedtitleskip
+\_newskip \_savedlastskip
+\_def\_abovetitle #1#2{\_savedlastskip=\_lastskip % <whatever-skip>
+ \_ifdim\_lastskip>0pt \_vskip-\_lastskip \_fi
+ \_ifnum\_lastpenalty=11333 \_vskip-\_savedtitleskip \_else #1\_fi
+ \_ifdim\_savedlastskip>0pt \_setbox0=\_vbox{#2\_global\_tmpdim=\_lastskip}%
+ \_else \_tmpdim=\_maxdimen \_fi
+ \_ifdim\_savedlastskip>\_tmpdim \vskip\_savedlastskip \_else #2\_fi
+}
+\_def\_belowtitle #1{#1\_global\_savedtitleskip=\_lastskip \_penalty11333 }
+
+ \_doc -----------------------------
+ `\nbpar` sets `\interlinepenaty` value.
+ `\nl` is \"new line" in text (or titles), but space in toc or healdlines or outlines.
+ \_cod -----------------------------
+
+\_def\_nbpar{{\_interlinepenalty=10000\_endgraf}}
+
+\_protected\def\_nl{\hfil\break}
+\_regmacro {\def\_nl{\_unskip\_space}} {\def\_nl{\_unskip\_space}} {\def\_nl{ }}
+\_regmacro {\def\nl{\_unskip\_space}} {\def\nl{\_unskip\_space}} {\def\nl{ }}
+
+\_public \nbpar \nl ;
+
+ \_doc -----------------------------
+ `\_firstnoindent` puts a material to `\everypar` in order to next
+ paragraph will be without indentation. It is useful after titles.
+ If you dislike this feature then you can say `\let\_firtnoindent=\relax`.
+ The `\_wipeepar` removes the material from `\everypar`.
+ \_cod -----------------------------
+
+\_def \_afternoindent {\_global\_everypar={\_wipeepar \_setbox7=\_lastbox}}
+\_def \_wipeepar {\_global\_everypar={}}
+\_let \_firstnoindent=\_afternoindent
+
+ \_doc -----------------------------
+ The `\mark` (for running heads) is used in `\_printsection` only. We
+ suppose that chapters will be printed after `\vfil\break`, so user can
+ implement chapter titles for running headers directly by macros, no
+ `\mark` machanism is needed. But sections need `\mark`s. And they can be
+ mixed with chapter's running heads, of course.
+
+ The `\_insermark{<title text>}` saves `\mark` in the format
+ `{<title-num>} {<title-text>}`, so it can be printed \"as is" in
+ `\headline` (see the space between them), or you can define a formating
+ macro with two parameters for processing these data, if you need it.
+ \_cod -----------------------------
+
+\_def\_insertmark#1{\_mark{{\_ifnonum\_else\_therefnum\_fi} {\_unexpanded{#1}}}}
+
+ \_doc -----------------------------
+ \OpTeX/ sets `\headline={}` by default, so no running heads are printed.
+ You can activate the running heads by following code, for example:
+ \begtt
+ \addto \_chapx {\_edef\_runningchap {\_thechapnum: \_unexpanded\_ea{\_savedtitle}}}
+ \def \formathead #1#2{\isempty{#1}\iffalse #1: #2\fi}
+ \headline = {%
+ \ifodd \pageno
+ \hfil \ea\formathead\firstmark{}{}%
+ \else
+ Chapter: \runningchap \hfil
+ \fi
+ }
+ \endtt
+
+ The `\caption/<letter>` uses `\_<letter>num` counter.
+ The group opened by `\caption` is finalized by first \par from
+ empty line or from `\vskip` or from `\endinsert`.
+ The `\_printcaption<letter>` is called, it starts with
+ printing of the caption.
+ \_cod -----------------------------
+
+\_def\_caption/#1{\_def\_tmpa{#1}\_nospaceafter \_capA}
+\_optdef\_capA []{\_trylabel \_incaption}
+\_def\_incaption {\_bgroup
+ \_ifcsname _\_tmpa num\_endcsname \_ea\_incr \_csname _\_tmpa num\_endcsname
+ \_else \_opwarning{Unknown caption /\_tmpa}\_fi
+ \_edef\_thecapnum {\csname _the\_tmpa num\endcsname}%
+ \_edef\_thecaptitle{\_mtext{\_tmpa}}%
+ \_ifcsname _everycaption\_tmpa\_endcsname
+ \_ea\_the \_csname _everycaption\_tmpa\_endcsname \_fi
+ \_def\_par{\_nbpar\_egroup}\_let\par=\_par
+ \_cs{_printcaption\_tmpa}%
+}
+
+ \_doc -----------------------------
+ The `\_printcaption<letter>` macro starts in vertical mode. It must
+ switch to horizontal mode, it must use `\_wlabel\_thecapnum` (in order to
+ make reference and hyperlink destination) a it can use:
+ \begitems
+ * `\_thecaptitle` ... expands to the word Table or Figure (depending on
+ the current language).
+ * `\_thecapnum` ... expands to `\the<letter>num` (caption number).
+ \enditems
+ \_cod -----------------------------
+
+\_def \_printcaptiont {%
+ \_noindent \_wlabel\_thecapnum {\_bf\_thecaptitle~\_thecapnum}\_enspace
+ \_narrowlastlinecentered\_iindent
+}
+\_let \_printcaptionf = \_printcaptiont % caption of figures = caption of tables
+\_def \_cskip {\_par\_nobreak\_medskip} % space between caption and the object
+
+\_public \caption \cskip ;
+
+ \_doc -----------------------------
+ The default format of `\caption` text is paragraph in block narrower by
+ `\_iindent` and with the last line is centered. This setting is done by
+ `\_narrowlastlinecentered` macro.
+ \_cod -----------------------------
+
+\_def\_narrowlastlinecentered#1{%
+ \_leftskip=#1plus1fil
+ \_rightskip=#1plus-1fil
+ \_parfillskip=0pt plus2fil
+}
+
+ \_doc -----------------------------
+ `\eqmark` is processed in display mode (we add `\eqno` primitive)
+ or in internal mode when `\eqaligno` is used (we don't add `\eqno`).
+ \_cod -----------------------------
+
+\_optdef\_eqmark []{\_trylabel \_ineqmark}
+\_def\_ineqmark{\_incr\_dnum
+ \_ifinner\_else\_eqno \_fi
+ \_wlabel\_thednum \_thednum
+}
+\_public \eqmark ;
+
+\_endcode % -------------------------------------
+
+
diff --git a/Master/texmf-dist/tex/luatex/optex/styles.opm b/Master/texmf-dist/tex/luatex/optex/styles.opm
new file mode 100644
index 00000000000..66414f85ff6
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/styles.opm
@@ -0,0 +1,98 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \report {Basic styles of OpTeX <2020-03-12>}
+
+ \_doc -----------------------------
+ The `{\boxlines <line-1><eol><line-2><eol>...<line-n><eol>}`
+ returns to the outer vertical mode a box with <line-1>, next box with
+ <line-2> etc. Each box has its natural width. This is reaon why we cannot
+ use paragraph mode where each resulting box has the width `\hsize`.
+ The <eol> is set active and `\everypar` starts `\hbox{` and acive <eol>
+ closes this `\hbox` by `}`.
+ \_cod -----------------------------
+
+\_def\_boxlines{%
+ \_def\_boxlinesE{\_ifhmode\_egroup\_empty\_fi}%
+ \_def\_nl{\_boxlinesE}%
+ \_bgroup \_lccode`\~=`\^^M\_lowercase{\_egroup\_let~}\_boxlinesE
+ \_everypar{\_setbox0=\_lastbox\_endgraf
+ \_hbox\_bgroup \_catcode`\^^M=13 \_let\par=\_nl \_aftergroup\_boxlinesC}%
+}
+\_def\_boxlinesC{\_futurelet\_next\_boxlinesD}
+\_def\_boxlinesD{\_ifx\_next\_empty\_else\_ea\_egroup\_fi}
+
+ \_doc -----------------------------
+ The `\report` and `\letter` style initialization macos are defined here.
+ Their behavior is documented in user part of the manual in the section \ref[styles].
+ \_cod -----------------------------
+
+\_def\_report{
+ \_typosize[11/13.2]
+ \_let\_titfont=\_chapfont
+ \_titskip=3ex
+ \_eoldef\_author##1{\_removelastskip\_bigskip
+ {\_leftskip=0pt plus1fill \_rightskip=\_leftskip \_it \_noindent ##1\_par}\_nobreak\_bigskip
+ }
+ \_public \author ;
+ \_parindent=1.2em \_iindent=\_parindent \_ttindent=\_parindent
+ \_footline={\_global\_footline={\_hss\_rmfixed\_folio\_hss}}
+}
+\_def\_letter{
+ \_def\_address{\_vtop\_bgroup\_boxlines \_parskip=0pt \_let\par=\_egroup}
+ \_def\_subject{{\_bf \_mtext{subj}: }}
+ \_public \address \subject ;
+ \_typosize[11/14]
+ \_parindent=0pt
+ \_parskip=\_medskipamount
+ \_nopagenumbers
+}
+\_public \boxlines \letter \report ;
+
+\_endcode % -------------------------------------
+
+The example of `\letter` style document follows:
+
+\begtt %-----------------------------------------------------------------
+
+\letter
+\fontfam[bonum]
+\chyph
+
+\address
+ Vážený pan
+ Mgr. Bořek Byrokrat
+ ředitel Ústavu pro další možnosti
+ Úřední 789
+ 123 45 Praha 1
+
+\hfill V Praze dne \today
+
+\subject Žádost o možnost další možnosti
+
+Vážený pane řediteli
+
+na základě Vašeho dopisu č.j.~123456/78-dat a elektronické výzvy si dovoluji
+Vás požádat o prozkoumání mé možnosti další možnosti.
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
+eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
+veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
+commodo consequat.
+
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
+eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
+veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
+commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
+esse cillum dolore eu fugiat nulla pariatur.
+
+S úctou
+
+\hfill \address
+ {\it Petr Olšák}
+ specialista na \TeX{}
+ Ulice 12345
+ Praha 13
+
+\bye
+
+\endtt %---------------------------------------------------------------------
+
diff --git a/Master/texmf-dist/tex/luatex/optex/table.opm b/Master/texmf-dist/tex/luatex/optex/table.opm
new file mode 100644
index 00000000000..3596275e488
--- /dev/null
+++ b/Master/texmf-dist/tex/luatex/optex/table.opm
@@ -0,0 +1,201 @@
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
+
+\_codedecl \table {Basic macros for OpTeX <2020-03-12>}
+
+ \_doc -----------------------------
+ The result of `\table` is inserted into `\_tablebox`. You can change
+ default value if you want `\let\_tablebox=\vtop` or `\let\_tablebox=\relax`.
+ \_cod -----------------------------
+
+\_let\_tablebox=\_vbox
+
+ \_doc -----------------------------
+ Categories )for example of `|` character) have to be normal when reading
+ `\table` parameters.
+ \_cod -----------------------------
+
+\_def\_table{\_tablebox\_bgroup \_catcodetable\_optexcatcodes \_tableA}
+\_public \table ;
+
+ \_doc -----------------------------
+ The `\_tablinspace` is implemented by enlarging given `\tabstrut`
+ by desired dimension (height and depth too) and by setting
+ `\_lineskip=-2\_tablinspace`. So, normal table rows where no `\hrule` is
+ between them have normal baseline distance.
+ \_cod -----------------------------
+
+\_def\_tableA#1{%
+ \_the\_thistable \_global\_thistable={}%
+ \_ea\_ifx\_ea^\_the\_tabstrut^\_setbox\_tstrutbox=\_null
+ \_else \_setbox\_tstrutbox=\_hbox{\_the\_tabstrut}%
+ \_setbox\_tstrutbox=\_hbox{\_vrule width0pt
+ height\_dimexpr\_ht\_tstrutbox+\_tablinespace
+ depth\_dimexpr\_dp\_tstrutbox+\_tablinespace}%
+ \_offinterlineskip
+ \_lineskip=-2\_tablinespace
+ \_fi
+ \_colnum=0 \_def\_tmpa{}\_tabdata={}\_scantabdata#1\_relax
+ \_the\_everytable \_tableB
+}
+\_def\_tableB#1{\_halign\_ea{\_the\_tabdata\_cr#1\_crcr}\_egroup}
+\_newbox\_tstrutbox % strut used in table rows
+\_newtoks\_tabdata % the \halign declaration line
+\_newcount\_colnum % number of columns
+
+ \_doc -----------------------------
+ The `\_scantabdata` converts `\table` <declaration> to `\halign` <declaration>.
+ The result is stored into `\_tbdata` tokens list. For example, the `\_scandata` creates
+ following result when <declaration>=`|cr||cl|`.
+ \begtt
+ tabdata: \_vrule\_the\_tabiteml\_hfil#\_unsskip\_hfil\_the\_tabitemr\_tabstrutA
+ &\_the\_tabiteml\_hfil#\_unsskip\_the\_tabitemr \_vrule\_kern\_vvkern\_vrule\_tabstrutA
+ &\_the\_tabiteml\_hfil#\_unsskip\_hfil\_the\_tabitemr\_tabstrutA
+ &\_the\_tabiteml#\_unsskip\_hfil\_the\_tabitemr\_vrule\_tabstrutA
+ ddlinedata: &\_dditem &\_dditem\_vvitem &\_dditem &\_dditem
+ \endtt
+ The second result in `\_ddlinedata` macro is a teplate of one row of the table
+ used by `\crli` macro.
+ \_cod -----------------------------
+
+\_def\_scantabdata#1{\_let\_next=\_scantabdata
+ \_ifx\_relax#1\_let\_next=\_relax
+ \_else\_ifx|#1\_addtabvrule
+ \_else\_ifx(#1\_def\_next{\_scantabdataE}%
+ \_else\_isinlist{123456789}#1\_iftrue \_def\_next{\_scantabdataC#1}%
+ \_else \_ea\_ifx\_csname _tabdeclare#1\_endcsname \_relax
+ \_ea\_ifx\_csname _paramtabdeclare#1\_endcsname \_relax
+ \_opwarning{tab-declarator "#1" unknown, ignored}%
+ \_else
+ \_def\_next{\_ea\_scantabdataB\_csname _paramtabdeclare#1\_endcsname}\_fi
+ \_else \_def\_next{\_ea\_scantabdataA\_csname _tabdeclare#1\_endcsname}%
+ \_fi\_fi\_fi\_fi\_fi \_next
+}
+\_def\_scantabdataA#1{\_addtabitem \_ea\_addtabdata\_ea{#1\_tabstrutA}\_scantabdata}
+\_def\_scantabdataB#1#2{\_addtabitem\_ea\_addtabdata\_ea{#1{#2}\_tabstrutA}\_scantabdata}
+\_def\_scantabdataC {\_def\_tmpb{}\_afterassignment\_scantabdataD \_tmpnum=}
+\_def\_scantabdataD#1{\_loop \_ifnum\_tmpnum>0 \_advance\_tmpnum by-1 \_addto\_tmpb{#1}\_repeat
+ \_ea\_scantabdata\_tmpb}
+\_def\_scantabdataE#1){\_addtabdata{#1}\_scantabdata}
+
+\_def\_addtabitem{\_ifnum\_colnum>0 \_addtabdata{&}\_addto\_ddlinedata{&\_dditem}\_fi
+ \_advance\_colnum by1 \_let\_tmpa=\_relax}
+\_def\_addtabdata#1{\_toksapp\_tabdata{#1}}
+\_def\_addtabvrule{%
+ \_ifx\_tmpa\_vrule \_addtabdata{\_kern\_vvkern}%
+ \_ifnum\_colnum=0 \_addto\_vvleft{\_vvitem}\_else\_addto\_ddlinedata{\_vvitem}\_fi
+ \_else \_ifnum\_colnum=0 \_addto\_vvleft{\_vvitemA}\_else\_addto\_ddlinedata{\_vvitemA}\_fi\_fi
+ \_let\_tmpa=\_vrule \_addtabdata{\_vrule}%
+}
+\_def\_tabstrutA{\_copy\_tstrutbox}
+\_def\_vvleft{}
+\_def\_ddlinedata{}
+
+ \_doc -----------------------------
+ The default \"declaration letters" `c`, `l`, `r` and `p` are defined here.
+ You can define more such leeters by `\def\_tabdeclare<letter>{...}` for a non-parametric
+ letter and by `\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.
+ \_cod -----------------------------
+
+\_def\_tabdeclarec{\_the\_tabiteml\_hfil##\_unsskip\_hfil\_the\_tabitemr}
+\_def\_tabdeclarel{\_the\_tabiteml##\_unsskip\_hfil\_the\_tabitemr}
+\_def\_tabdeclarer{\_the\_tabiteml\_hfil##\_unsskip\_the\_tabitemr}
+\_def\_paramtabdeclarep#1{\_the\_tabiteml
+ \_vtop{\_hsize=#1\_relax \_baselineskip=\_normalbaselineskip
+ \_lineskiplimit=0pt \_noindent##\_unsskip \_lower\_dp\_tstrutbox\hbox{}}\_the\_tabitemr}
+
+ \_doc -----------------------------
+ User puts optional spaces around the table item typically, i.e. he/she writes
+ `& text &` instead `&text&`. The left space is ignored by internal \TeX/ algorithm but
+ the right space must be removed by macros. This is a reason why we reccomend to
+ use `\_unsskip` after each `##` in your definition of \"declaration letters".
+ This macro isn't only the primitive `\unskip` because we allow usage of plain \TeX/
+ `\hideskip` macro: `&\hideskip text\hideskip&`.
+ \_cod -----------------------------
+
+\_def\_unsskip{\_ifdim\_lastskip>0pt \_unskip\_fi}
+
+ \_doc -----------------------------
+ The family of `\_cr*` macros and `\tskip <dimen>` is implemented here.
+ The `\_zerotabrule` is used in order to suppress the negative `\lineskip`
+ declared by `\tablinespace`.
+ \_cod -----------------------------
+
+\_def\_crl{\_crcr\_noalign{\_hrule}}
+\_def\_crll{\_crcr\_noalign{\_hrule\_kern\_hhkern\_hrule}}
+\_def\_zerotabrule {\_noalign{\_hrule height0pt width0pt depth0pt}}
+
+\_def\_crli{\_crcr \_zerotabrule \_omit
+ \_gdef\_dditem{\_omit\_tablinefil}\_gdef\_vvitem{\_kern\_vvkern\_vrule}\_gdef\_vvitemA{\_vrule}%
+ \_vvleft\_tablinefil\_ddlinedata\_crcr \_zerotabrule}
+\_def\_crlli{\_crli\_noalign{\_kern\_hhkern}\_crli}
+\_def\_tablinefil{\_leaders\_hrule\_hfil}
+
+\_def\_crlp#1{\_crcr \_zerotabrule \_noalign{\_kern-\_drulewidth}%
+ \_omit \_xdef\_crlplist{#1}\_xdef\_crlplist{,\_expandafter}\_expandafter\_crlpA\_crlplist,\_end,%
+ \_global\_tmpnum=0 \_gdef\_dditem{\_omit\_crlpD}%
+ \_gdef\_vvitem{\_kern\_vvkern\_kern\_drulewidth}\_gdef\_vvitemA{\_kern\_drulewidth}%
+ \_vvleft\_crlpD\_ddlinedata \_global\_tmpnum=0 \_crcr \_zerotabrule}
+\_def\_crlpA#1,{\_ifx\_end#1\_else \_crlpB#1-\_end,\_expandafter\_crlpA\_fi}
+\_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,}}%
+ \_tmpa\_iftrue \_kern-\_drulewidth \_tablinefil \_kern-\_drulewidth\_else\_hfil \_fi}
+
+\_def\_tskip{\_afterassignment\_tskipA \_tmpdim}
+\_def\_tskipA{\_gdef\_dditem{}\_gdef\_vvitem{}\_gdef\_vvitemA{}\_gdef\_tabstrutA{}%
+ \_vbox to\_tmpdim{}\_ddlinedata \_crcr
+ \_zerotabrule \_noalign{\_gdef\_tabstrutA{\_copy\_tstrutbox}}}
+
+\_public \crl \crll \crli \crlli \crlp \tskip ;
+
+ \_doc -----------------------------
+ The `\mspan[<declaration>]{<text>}` macro generates similar `\omit\span\omit\span`
+ sequence as plain \TeX/ macro `\multispan`. Moreover, it uses `\_scantabdata` to
+ convert <declaration> from `\table` syntax to `\halign` syntax.
+ \_cod -----------------------------
+
+\_def\_mspan{\_omit \_tabdata={\_tabstrutA}\_let\_tmpa=\_relax \_afterassignment\_mspanA \_mscount=}
+\_def\_mspanA[#1]#2{\_loop \_ifnum\_mscount>1 \_cs{_span}\_omit \_advance\_mscount-1 \_repeat
+ \_colnum=0 \_def\_tmpa{}\_tabdata={}\_scantabdata#1\_relax
+ \_setbox0=\_vbox{\_halign\_expandafter{\_the\_tabdata\_cr#2\_crcr}\_global\_setbox8=\_lastbox}%
+ \_setbox0=\_hbox{\_unhbox8 \_unskip \_global\_setbox8=\_lastbox}%
+ \_unhbox8 \_ignorespaces}
+\_public \mspan ;
+
+ \_doc -----------------------------
+ The parameters of primitive `\vrule` and `\hrule` keeps the rule \"last wins".
+ If we re-define `\hrule` to `\_orihrule height1pt` then each usage
+ of redefined `\hrule` uses `1pt` height if this parameter isn't
+ overwriten by another following `height` parameter. This principle is used for
+ settings another default rule thickness than 0.4pt.
+ \_cod -----------------------------
+
+\_newdimen\_drulewidth \_drulewidth=0.4pt
+\_let\_orihrule=\_hrule \_let\_orivrule=\_vrule
+\_def\_rulewidth{\_afterassignment\_rulewidthA \_drulewidth}
+\_def\_rulewidthA{\_edef\_hrule{\_orihrule height\_drulewidth}%
+ \_edef\_vrule{\_orivrule width\_drulewidth}%
+ \_let\_rulewidth=\_drulewidth
+ \_public \vrule \hrule \rulewidth;}
+\_public \rulewidth ;
+
+ \_doc -----------------------------
+ The `\frame` uses \"`\vbox` in `\vtop`" trick in order to keep the
+ baseline of the internal text at the same level as outer baseline.
+ User can write `\frame{abcxyz}` in normal paragraph line, for example
+ and gets the expected result: \frame{abcxyz}.
+ The internal margins are set by `\vvkern` and `\hhkern` parameters.
+ \_cod -----------------------------
+
+\_long\_def\_frame#1{%
+ \_hbox{\_vrule\_vtop{\_vbox{\_hrule\_kern\_vvkern
+ \_hbox{\_kern\_hhkern\_relax#1\_kern\_hhkern}%
+ }\_kern\_vvkern\_hrule}\_vrule}}
+\_public \frame ;
+
+\_endcode % -------------------------------------
+
+
diff --git a/Master/texmf-dist/tex/luatex/optex/unimath-codes.opm b/Master/texmf-dist/tex/luatex/optex/unimath-codes.opm
index b6d9226a954..3e5b95669d2 100644
--- a/Master/texmf-dist/tex/luatex/optex/unimath-codes.opm
+++ b/Master/texmf-dist/tex/luatex/optex/unimath-codes.opm
@@ -269,8 +269,8 @@
\mathcode`\_="8000
\_private
- \ldotp \cdotp \triangleleft \trianglerigt \mapstochar \rightarrow \prime
- \lhook \rightarrow \leftarrow \rhook \triangleright \triangleleft
+ \ldotp \cdotp \bullet \triangleleft \trianglerigt \mapstochar \rightarrow
+ \prime \lhook \rightarrow \leftarrow \rhook \triangleright \triangleleft
\Relbar \Rightarrow \relbar \rightarrow \Leftarrow \mapstochar
\longrightarrow \Longleftrightarrow \vdots \ddots ;
diff --git a/Master/texmf-dist/tex/luatex/optex/usebib.opm b/Master/texmf-dist/tex/luatex/optex/usebib.opm
index 4ff38c87369..ebaf912b539 100644
--- a/Master/texmf-dist/tex/luatex/optex/usebib.opm
+++ b/Master/texmf-dist/tex/luatex/optex/usebib.opm
@@ -1,204 +1,190 @@
-% opmac-bib
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Petr Olsak, version Feb. 2018 (beta)
-
-% This is module for OPmac macros, see http://petr.olsak.net/opmac.html
-% The command:
-% \usebib/<sorttype> (<style>) (bibfiles>
-% for direct reading .bib files by OPmac macros (without bibTeX) is implemented here.
-% The implementation depends on librarian.tex package by Paul Isambert.
-% Use:
-% \input opmac \input opmac-bib
-% or simply:
-% \input opmac-bib
-% before using the command \usebib.
-% For more information see the end of this file.
+%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\ifx\MakeReference\udefined \else \endinput \fi
-\ifx\OPmacversion\undefined \input opmac \fi
-\ifx\printbib\undefined
- \errmessage{Please, upgrade OPmac to version Apr. 2014 or newer}
- \endinput\fi
+\_ifx\MakeReference\_udefined \_else \_endinput \_fi
% we needn't \errmessage when bad TeX engnine is detected during \input librarian:
-\def\tmp{}
-\let\errmessageori=\errmessage
-\def\errmessage#1{\def\tmp{error}}
-\let\newwriteori=\newwrite % we need not to create \jobname.lbr:
-\def\newwrite#1{\csname lb@restoreat\endcsname \endinput}
-\catcode`\_=12
-\input librarian
-\catcode`\_=11
-\let\errmessage=\errmessageori
-\let\newwrite=\newwriteori
-\ifx\tmp\empty\else
- \def\usebib/#1 (#2) #3 {%
- \opwarning{eTeX and (pdfTeX or XeTeX or LuaTeX) not detected}%
- \immediate\write16{\space\space
- But librarian package needs it. \noexpand\usebib ignored.}%
+\_def\_tmp{}
+\_let\_errmessageori=\_errmessage
+\_def\_errmessage#1{\_def\_tmp{error}}
+\_let\_newwriteori=\_newwrite % we need not to create \jobname.lbr:
+\_def\_newwrite#1{\_csname lb@restoreat\_endcsname \_endinput}
+\_def\_tmpb{\_catcode`\_=12 \_input librarian \_catcode`\_=11 }\_tmpb
+\_let\_errmessage=\_errmessageori
+\_let\_newwrite=\_newwriteori
+\_ifx\_tmp\_empty\_else
+ \_def\_usebib/#1 (#2) #3 {%
+ \_opwarning{eTeX and (pdfTeX or XeTeX or LuaTeX) not detected}%
+ \_immediate\_write16{\_space\_space
+ But librarian package needs it. \_noexpand\usebib ignored.}%
}
- \endinput \fi
+ \_endinput \_fi
+\_private \BibFile \ReadList \SortList \SortingOrder \NameCount \AbbreviateFirstname
+ \CreateField \RetrieveFieldInFor \RetrieveFieldIn ;
% The \usebib command:
-\def\usebib/#1 (#2) #3 {%
- \ifx\citelist\empty
- \opwarning{No cited items. \noexpand\usebib ignored}%
- \else
- \bgroup \par
- \ifx\bibpart\undefined \def\bibpart{none}\fi
- \catcode`<=12
- \ifx\savedttchar\undefined\else \catcode\savedttchar=12 \fi
- \def\opmacbibstyle{#2}%
- \input bib-#2.opm
- \bibtexhook
- \let\citeI=\relax \xdef\citelist{\citelist\citelistB}%
- \global\let\addcitelist=\writeXcite
- \def\tmp##1[*]##2\relax{\def\tmp{##2}}\expandafter\tmp\citelist[*]\relax
- \ifx\tmp\empty\else % there was \nocite[*] used.
- \setbox0=\vbox{\def\citelist{}\adef@{\readbibentry}%
- \input #3.bib
- \expandafter}\expandafter\def\expandafter\citelist\expandafter{\citelist}%
- \fi
- \def\citeI[##1]{\csname lb@cite\endcsname{##1}{\bibpart}{}{}}\citelist
- \BibFile{#3}%
- \if s#1\def\warntwobytes{}\def\warnthreebytes{}% \scantokens is used during sorting
- \SortList{\bibpart}\fi
- \ReadList{\bibpart}%
- \egroup
- \fi
+\_def\_usebib/#1 (#2) #3 {%
+ \_ifx\_citelist\_empty
+ \_opwarning{No cited items. \_noexpand\usebib ignored}%
+ \_else
+ \_bgroup \_par
+ \_emergencystretch=.3\_hsize
+ \_ifx\_bibpart\_undefined \_def\_bibpart{none}\_fi
+ \_def\_optexbibstyle{#2}%
+ \_setctable\_optexcatcodes
+ \_input bib-#2.opm
+ \_the \_bibtexhook
+ \_let\_citeI=\_relax \_xdef\_citelist{\_citelist\_citelistB}%
+ \_global\_let\_addcitelist=\_writeXcite
+ \_def\_tmp##1[*]##2\_relax{\_def\_tmp{##2}}\_expandafter\_tmp\_citelist[*]\_relax
+ \_ifx\_tmp\_empty\_else % there was \nocite[*] used.
+ \_setbox0=\_vbox{\_hsize=\_maxdimen \_def\_citelist{}\_adef@{\_readbibentry}%
+ \_input #3.bib
+ \_expandafter}\_expandafter\_def\_expandafter\_citelist\_expandafter{\_citelist}%
+ \_fi
+ \_def\_citeI[##1]{\_csname lb@cite\_endcsname{##1}{\_bibpart}{}{}}\_citelist
+ \_BibFile{#3}%
+ \_if s#1\_SortList{\_bibpart}\_fi
+ \_ReadList{\_bibpart}%
+ \_restorectable
+ \_egroup
+ \_fi
}
-\def\readbibentry#1#{\readbibentryA}
-\def\readbibentryA#1{\readbibentryB#1,,\relax!.}
-\def\readbibentryB#1#2,#3\relax!.{\addto\citelist{\citeI[#1#2]}}
+\_def\_readbibentry#1#{\_readbibentryA}
+\_def\_readbibentryA#1{\_readbibentryB#1,,\_relax!.}
+\_def\_readbibentryB#1#2,#3\_relax!.{\_addto\_citelist{\_citeI[#1#2]}}
% Corrections in librarian macros:
-\tmpnum=\catcode`\@ \catcode`\@=11
-\def\lb@checkmissingentries#1,{% we needn't \errmessage here, only \opmacwarning
- \def\lb@temp{#1}%
- \unless\ifx\lb@temp\lb@eoe
+\_tmpnum=\_catcode`\@ \_catcode`\@=11
+\_def\lb@checkmissingentries#1,{% we needn't \errmessage here, only \opmacwarning
+ \_def\lb@temp{#1}%
+ \_unless\_ifx\lb@temp\lb@eoe
\lb@ifcs{#1}{fields}%
{}%
- {\opwarning{\string\usebib: entry [#1] isn't found in .bib file(s)}}%
- \expandafter\lb@checkmissingentries
- \fi
+ {\_opwarning{\_string\_usebib: entry [#1] isn't found in .bib file(s)}}%
+ \_ea\lb@checkmissingentries
+ \_fi
}
-\def\lb@readentry#1#2#3,{% space before key have to be ingnored
- \def\lb@temp{#2#3}% we need case sensitive keys
- \def\lb@next{\expandafter\lb@gotoat\lb@gobbletoeoe}%
+\_def\lb@readentry#1#2#3,{% space before key have to be ingnored
+ \_def\lb@temp{#2#3}% we need case sensitive keys
+ \_def\lb@next{\_ea\lb@gotoat\lb@gobbletoeoe}%
\lb@ifcs\lb@temp{requested}%
- {\let\lb@entrykey\lb@temp
+ {\_let\lb@entrykey\lb@temp
\lb@ifcs\lb@entrykey{fields}{}%
{\lb@defcs\lb@entrykey{fields}{}%
- \lowercase{\lb@addfield{entrytype}{#1}}%
- \let\lb@next\lb@analyzeentry}}{}%
+ \_lowercase{\lb@addfield{entrytype}{#1}}%
+ \_let\lb@next\lb@analyzeentry}}{}%
\lb@next
}
-\let\lb@compareA=\lb@compare
-\let\lb@preparesortA=\lb@preparesort
-\def\lb@compare#1\lb@eoe#2\lb@eoe{% SpecialSort:
- \ifx\lb@sorttype\lb@namestring
- \ifx\sortfield\undefined \lb@compareA#1\lb@eoe#2\lb@eoe
- \else
- \expandafter\RetrieveFieldInFor\expandafter{\sortfield}\lb@entrykey\lb@temp
- \ifx\lb@temp\empty \toks1={#1\lb@eoe}\else \toks1=\expandafter{\lb@temp\lb@eoe}\fi
- \expandafter\RetrieveFieldInFor\expandafter{\sortfield}\lb@currententry\lb@temp
- \ifx\lb@temp\empty \toks2={#2\lb@eoe}\else \toks2=\expandafter{\lb@temp\lb@eoe}\fi
- \edef\lb@temp{\noexpand\lb@compareA\space\the\toks1 \space\the\toks2}\lb@temp
- \fi
- \else \lb@compareA#1\lb@eoe#2\lb@eoe \fi
+\_let\lb@compareA=\lb@compare
+\_let\lb@preparesortA=\lb@preparesort
+\_def\lb@compare#1\lb@eoe#2\lb@eoe{% SpecialSort:
+ \_ifx\lb@sorttype\lb@namestring
+ \_ifx\_sortfield\_undefined \lb@compareA#1\lb@eoe#2\lb@eoe
+ \_else
+ \_ea\_RetrieveFieldInFor\_ea{\_sortfield}\lb@entrykey\lb@temp
+ \_ifx\lb@temp\_empty \_toks1={#1\lb@eoe}\_else \_toks1=\_ea{\lb@temp\lb@eoe}\_fi
+ \_ea\_RetrieveFieldInFor\_ea{\_sortfield}\lb@currententry\lb@temp
+ \_ifx\lb@temp\_empty \_toks2={#2\lb@eoe}\_else \_toks2=\_ea{\lb@temp\lb@eoe}\_fi
+ \_edef\lb@temp{\_noexpand\lb@compareA\_space\_the\_toks1 \_space\_the\_toks2}\lb@temp
+ \_fi
+ \_else \lb@compareA#1\lb@eoe#2\lb@eoe \_fi
}
-\def\lb@preparesort#1#2\lb@eoe{%
- \if#1-%
- \def\lb@sorttype{#2}%
- \else
- \def\lb@sorttype{#1#2}%
- \fi
+\_def\lb@preparesort#1#2\lb@eoe{%
+ \_if#1-%
+ \_def\lb@sorttype{#2}%
+ \_else
+ \_def\lb@sorttype{#1#2}%
+ \_fi
\lb@preparesortA#1#2\lb@eoe
}
-\def\SpecialSort#1{\def\sortfield{#1}}
-\def\WriteImmediateInfo#1{} % the existence of .lbr file bocks new reading of .bib
-\catcode`\@=\tmpnum
+\_def\_SpecialSort#1{\_def\_sortfield{#1}}
+\_def\WriteImmediateInfo#1{} % the existence of .lbr file bocks new reading of .bib
+\_catcode`\@=\_tmpnum
% Main action per every entry:
-\def\MakeReference{\par \ifnum\bibnum>0 \bibskip \fi
- \advance\bibnum by1
- \isdefined{bim:\the\bibnum}\iftrue
- \edef\tmpb{\csname bim:\the\bibnum\endcsname}%
- \bibmark=\expandafter{\tmpb}%
- \else \bibmark={}\fi
- \noindent \edef\tmpb{\EntryKey}%
- \printbib \dest[cite:\the\bibnum]%
- \bgroup
- \RetrieveFieldIn{entrytype}\entrytype
- \csname print:BEGIN\endcsname
- \isdefined{print:\entrytype}\iftrue
- \csname print:\entrytype\endcsname
- \else
- \ifx\entrytype\empty \else
- \opwarning{Entrytype @\entrytype\space from [\EntryKey] undefined}%
- \csname print:misc\endcsname
- \fi\fi
- \csname print:END\endcsname
- \ifx\wref\wrefrelax\else \immediate\wref\Xbib{{\EntryKey}{\the\bibnum}{\the\bibmark}}\fi
- \egroup \par
+\_def\MakeReference{\_par \_bibskip
+ \_advance\_bibnum by1
+ \_isdefined{_bim:\_the\_bibnum}\_iftrue
+ \_edef\_tmpb{\_csname _bim:\_the\_bibnum\_endcsname}%
+ \_bibmark=\_ea{\_tmpb}%
+ \_else \_bibmark={}\_fi
+ \_edef\_tmpb{\EntryKey}%
+ \_noindent \_dest[cite:\_the\_bibnum]\_printbib
+ {%
+ \_RetrieveFieldIn{entrytype}\_entrytype
+ \_csname _print:BEGIN\_endcsname
+ \_isdefined{_print:\_entrytype}\_iftrue
+ \_csname _print:\_entrytype\_endcsname
+ \_else
+ \_ifx\_entrytype\_empty \_else
+ \_opwarning{Entrytype @\_entrytype\_space from [\EntryKey] undefined}%
+ \_csname _print:misc\_endcsname
+ \_fi\_fi
+ \_csname _print:END\_endcsname
+ \_ifx\_wref\_wrefrelax\_else \_immediate\_wref\_Xbib{{\EntryKey}{\_the\_bibnum}{\_the\_bibmark}}\_fi
+ }\_par
}
% The \bprinta, \bprintb, \bprintc, \bprintv commands used in the style files:
-\def\bprinta {\bprintb*}
-\def\bprintb #1[#2#3]{%
- \def\bibfieldname{#2#3}%
- \if!#2\relax
- \def\bibfieldname{#3}%
- \RetrieveFieldIn{#3}\bibfield
- \ifx\bibfield\empty\else
- \RetrieveFieldIn{#3number}\namecount
- \def\bibfield{\csname Read#3\expandafter\endcsname\csname #3name\endcsname}%
- \fi
- \else
- \RetrieveFieldIn{#2#3}\bibfield
- \fi
- \if^#1^%
- \ifx\bibfield\empty \expandafter\expandafter\expandafter \doemptyfield
- \else \expandafter\expandafter\expandafter \dofullfield \fi
- \else \expandafter \bprintaA
- \fi
+\_def\_bprinta {\_bprintb*}
+\_def\_bprintb #1[#2#3]{%
+ \_def\_bibfieldname{#2#3}%
+ \_if!#2\_relax
+ \_def\_bibfieldname{#3}%
+ \_RetrieveFieldIn{#3}\_bibfield
+ \_ifx\_bibfield\_empty\_else
+ \_RetrieveFieldIn{#3number}\_namecount
+ \_def\_bibfield{\_csname _Read#3\_ea\_endcsname \_csname _pp:#3\_endcsname}%
+ \_fi
+ \_else
+ \_RetrieveFieldIn{#2#3}\_bibfield
+ \_fi
+ \_if^#1^%
+ \_ifx\_bibfield\_empty \_ea\_ea\_ea \_doemptyfield
+ \_else \_ea\_ea\_ea \_dofullfield \_fi
+ \_else \_ea \_bprintaA
+ \_fi
}
-\def\dofullfield#1#2{\def\dofield##1{#1}\expandafter\dofield\expandafter{\bibfield}}
-\def\doemptyfield#1#2{\def\dofield##1{#2}\expandafter\dofield\expandafter{\bibfield}}
-\let\Readauthor=\ReadAuthor \let\Readeditor=\ReadEditor
-\def\bprintaA #1#2{\ifx\bibfield\empty #2\else\bprintaB #1**\eee\fi}
-\def\bprintaB #1*#2*#3\eee{\if^#3^#1\else\expandafter\bprintaC\expandafter{\bibfield}{#1}{#2}\fi}
-\def\bprintaC #1#2#3{#2#1#3}
-\def\bprintc#1#2{\bprintcA#1#2**\relax}
-\def\bprintcA#1#2*#3*#4\relax{\ifx#1\empty \else \if^#4^#2\else#2#1#3\fi\fi}
-\def\bprintv [#1]#2#3{\def\tmpa{#2}\def\tmpb{#3}\bprintvA #1,,}
-\def\bprintvA #1,{%
- \if^#1^\tmpb\else
- \RetrieveFieldIn{#1}\tmp
- \ifx \tmp\empty
- \else \tmpa \def\tmpb{}\def\tmpa{}%
- \fi
- \expandafter \bprintvA
- \fi
+\_def\_dofullfield#1#2{\_def\_dofield##1{#1}\_ea\_dofield\_ea{\_bibfield}}
+\_def\_doemptyfield#1#2{\_def\_dofield##1{#2}\_ea\_dofield\_ea{\_bibfield}}
+\_let\_Readauthor=\ReadAuthor \_let\_Readeditor=\ReadEditor
+\_def\_bprintaA #1#2{\_ifx\_bibfield\_empty #2\_else\_bprintaB #1**\_eee\_fi}
+\_def\_bprintaB #1*#2*#3\_eee{\_if^#3^#1\_else\_ea\_bprintaC\_ea{\_bibfield}{#1}{#2}\_fi}
+\_def\_bprintaC #1#2#3{#2#1#3}
+\_def\_bprintc#1#2{\_bprintcA#1#2**\_relax}
+\_def\_bprintcA#1#2*#3*#4\_relax{\_ifx#1\_empty \_else \_if^#4^#2\_else#2#1#3\_fi\_fi}
+\_def\_bprintv [#1]#2#3{\_def\_tmpa{#2}\_def\_tmpb{#3}\_bprintvA #1,,}
+\_def\_bprintvA #1,{%
+ \_if^#1^\_tmpb\_else
+ \_RetrieveFieldIn{#1}\_tmp
+ \_ifx \_tmp\_empty
+ \_else \_tmpa \_def\_tmpb{}\_def\_tmpa{}%
+ \_fi
+ \_ea \_bprintvA
+ \_fi
}
+\_sdef{_pp:author}{\_letNames\_authorname}
+\_sdef{_pp:editor}{\_letNames\_editorname}
+\_def\_letNames{\_let\_Firstname=\Firstname \_let\_Lastname=\Lastname
+ \_let\_Von=\Von \_let\_Junior=\Junior
+}
% Various macros + multilinguas:
-\def\bibwarning{\opwarning{Missing field \string"\bibfieldname\string" in [\EntryKey]}}
+\_def\_bibwarning{\_opwarning{Missing field "\_bibfieldname" in [\EntryKey]}}
-\def\slet#1#2{\expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname}
-\def\mtdef#1#2#3#4{\sdef{_mt:#1:en}{#2} \sdef{_mt:#1:cs}{#3}
- \if$#4$\slet{_mt:#1:sk}{_mt:#1:cs}
- \else \sdef{_mt:#1:sk}{#4}
- \fi
+\_def\_mtdef#1#2#3#4{\_sdef{_mt:#1:en}{#2} \_sdef{_mt:#1:cs}{#3}
+ \_if$#4$\_slet{_mt:#1:sk}{_mt:#1:cs}
+ \_else \_sdef{_mt:#1:sk}{#4}
+ \_fi
}
-\endinput
+\_endcode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -208,8 +194,8 @@ The following command is implemented here:
where <sorttype> is one letter 'c' (references ordered by citation order in
the text) or 's' (references ordered by key in the style file),
-<style> is the part of the name `opmac-bib-<style>.tex' of the style file
-and <bibfiles> are one or more .bib file names without suffix separated by
+<style> is the part of the name `bib-<style>.opm` of the style file
+and <bibfiles> are one or more `.bib` file names without suffix separated by
comma without space. Example:
\usebib/s (simple) mybase,yourbase
@@ -217,118 +203,142 @@ comma without space. Example:
This command reads the <bibfiles> directly and creates the list of
bibliographics references (only those declared by by \cite[] or \nocite[]
in the text). The formatting of such references is defined in the style
-file. The usage is mentioned in OPmac documentation too.
+file. The usage is mentioned in user documentation too.
The principle "first entry wins" is used. Suppose
\usebib/s (simple) local,global
-If an entry with the same label is declared in local.bib and in
-global.bib too then the first wins. So, you can set an exceptions in your
+If an entry with the same label is declared in `local.bib` and in
+`global.bib` too then the first wins. So, you can set an exceptions in your
local.bib file for your document, for example.
Notes for style writers:
------------------------
-The opmac-bib-<style>.tex file must define the commands:
+The `bib-<style>.opm` file must define the commands:
-\authorname ... formatting of one name in the authors list. The macro can
- use the following data: \NameCount (the number of the currently
- processed author name in the list), 0\namecount (the total number of the
- authors in the list), \Lastname, \Firstname, \Von, \Junior (the parts of
- the name). See the documentation of the librarian package for more info.
+`\_authorname` ... formatting of one name in the authors list. The macro can
+ use the following data: `\_NameCount` (the number of the currently
+ processed author name in the list), `0\_namecount` (the total number of the
+ authors in the list), `\_Lastname`, `\_Firstname`, `\_Von`, `\_Junior`
+ (the parts of the name). See the documentation of the librarian package
+ for more info.
-\editorname ... the same as \authorname, but for editors list.
+`\_editorname` ... the same as `\_authorname`, but for editors list.
-print:<entrytype> (defined by \sdef) for formatting the entry of <entrytype>.
+`_print:<entrytype>` (defined by `\_sdef`) for formatting the entry of <entrytype>.
The <entrytype> have to be lowercase. This command can use the command:
-\bprinta [<fieldname>] {<if defined>} {<if not defined>}. The part <if defined>
+`\_bprinta [<fieldname>] {<if defined>} {<if not defined>}`. The part <if defined>
is executed if <fieldname> is declared in .bib file for the entry which is
currently processed. Else the part <if not defined> is processed.
- The part <if defined> can include the * parameter which is replaced
+ The part <if defined> can include the `*` parameter which is replaced
by the value of the <fieldname>. The part <if not defined> can include
- the \bibwarning command if the <fieldname> is mandatory.
-\bprintb [<fieldname>] {<if defined>} {<if not defined>}. The same as
- \bprinta, but the ##1 parameter is used instead *. Differences: ##1
+ the `\_bibwarning` command if the <fieldname> is mandatory.
+`\_bprintb [<fieldname>] {<if defined>} {<if not defined>}`. The same as
+ \_bprinta, but the `##1` parameter is used instead `*`. Differences: `##1`
parameter can be used more than once and can be enclosed in nested
braces. The * parameter can be used at most once and cannot be enclosed
- in braces. Warning: if the \bprintb commands are nested (\bprintb in
- \bprintb), then you need to write ####1 parameter for internal \bprintb.
- But if \bprinta commands are nested then the * parameter is not dubbled.
-\pbprintc \macro {<if non-empty>}. The <if non-empty> part is executed if
- \macro is non-empty. The * parameter can be used, it is replaced by
- the \macro.
-\bprintv [<field1>,<field2>,...] {<if defined>} {<if not defined>}.
+ in braces. Warning: if the `\_bprintb` commands are nested (`\_bprintb` in
+ `\_bprintb`), then you need to write `####1` parameter for internal `\_bprintb`.
+ But if `\_bprinta` commands are nested then the * parameter is not dubbled.
+`\_pbprintc \macro {<if non-empty>}`. The <if non-empty> part is executed if
+ `\macro` is non-empty. The * parameter can be used, it is replaced by
+ the `\macro`.
+`\_bprintv [<field1>,<field2>,...] {<if defined>} {<if not defined>}`.
The part <if defined> is executed if <field1> or <filed2> or ...
is defined, else the second part <if not defined> is executed.
There is one filed name or the list field names separated by commas.
The parts cannot include any parameter.
-There are two special fieldnames: !author and !editor. The processed list of
-authors or editors (by repeatedly calling \authorname or \editorname) are
+There are two special fieldnames: `!author` and `!editor`. The processed list of
+authors or editors (by repeatedly calling `\_authorname` or `\_editorname`) are
used here insted of raw data.
-You can define print:BEGIN and/or print:END which is executed at the begin or
+You can define `_print:BEGIN` and/or `_print:END` which is executed at the begin or
end of each <entrytype>. The formatting does not solve the numbering and
-paragraph indentation of the entry. This is processed by \printbib macro
-used in OPmac (and may be redefined by the author or document designer).
+paragraph indentation of the entry. This is processed by `\_printbib` macro
+used in \OpTeX/ (and may be redefined by the author or document designer).
-You can declare \bimark={something} in the print:END macro. This bibmark is
-saved to the .ref file (created by OPmac) and used in the next TeX run as \cite
-marks when \nonumcitations is set.
+You can declare `\_bimark={something}` in the `_print:END` macro. This bibmark is
+saved to the `.ref` file (created by \OpTeX/) and used in the next \TeX/ run as
+`\cite` marks when `\nonumcitations` is set.
-The whole style file is read in the group during \usebib command is executed
+The whole style file is read in the group during `\usebib` command is executed
before typesetting the reference list. Each definition or setting is local
here.
If you are using non-standard fieldnames in .bib database and bib. style,
-you has to declare them by \CreateField {<fieldname>}.
+you has to declare them by `\_CreateField {<fieldname>}`.
-You can declare \SortingOrder in the manner documented by librarian package.
+You can declare \_SortingOrder in the manner documented by librarian package.
If your style adds some words or abbreviations you can make them
-multilingual by saying \mtext{<label>} instead such word and
-\mtdef{<label>} {<English>} {<Czech>} {<Slovak>} declaration.
-The right part is printed by current value of the \language regiter.
-You can add more languages by re-defining the \mtdef command
-and by \sdef{lan:<language number>}{<language mark>}. See the opmac.tex
-for inspiration.
+multilingual by saying `\_mtext{<label>}` instead such word and
+`\_mtdef{<label>} {<English>} {<Czech>} {<Slovak>}` declaration.
+The right part is printed by current value of the `\language` regiter.
+You can add more languages by re-defining the `\_mtdef` command.
+See the section \ref[languages] for more information.
-If you are using \nonumcitations, then the \bibmark toks register have to be
-prepared in the style file (in print:BEGIN, print:END, in \authorname etc.)
-This value will be used in the \cite[] places in the document.
+If you are using `\nonumcitations`, then the `\_bibmark` tokens register have to be
+prepared in the style file (in `_print:BEGIN`, `_print:END`, in
+`\_authorname` etc.) This value will be used in the `\cite[]` places
+in the document.
-The example of the style file is in opmac-bib-simple.tex.
+The example of the style file is in `bib-simple.opm`.
User or author of the bib. style can create the hidden field which has a
precedence while sorting names. Example:
+\begtt
\CreateField {sortedby}
\SpecialSort {sortedby}
+\endtt
Suppose that the .bib file includes:
+\begtt
...
author = "Jan Chadima",
sortedby = "Hzzadima Jan",
...
+\endtt
Now, this author is sorted between H and I, because the Ch digraph in this
name has to be sorted by this rule.
If you need (for example) to place the autocitations before other citations,
-then you can mark your entries in .bib file by sortedby = "@", because this
+then you can mark your entries in `.bib` file by `sortedby = "@"`, because this
character is sorted before A.
+\_endinput
History:
--------
-Apr. 2014: released
+Apr. 2014: released in OPmac
Jan. 2016: "first entry wins" implemented
Apr. 2016: \readentry -> \readbibentry, \usebib->\MakeReference
Feb. 2018: \input librarian does not create \jobname.lbr
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end of the opmac-bib.tex
+% Source:
+
+% opmac-bib
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Petr Olsak, version Feb. 2018 (beta)
+
+% This is module for OPmac macros, see http://petr.olsak.net/opmac.html
+% The command:
+% \usebib/<sorttype> (<style>) (bibfiles>
+% for direct reading .bib files by OPmac macros (without bibTeX) is implemented here.
+% The implementation depends on librarian.tex package by Paul Isambert.
+% Use:
+% \input opmac \input opmac-bib
+% or simply:
+% \input opmac-bib
+% before using the command \usebib.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end
+
diff --git a/Master/texmf-dist/tex/luatex/optex/verbatim.opm b/Master/texmf-dist/tex/luatex/optex/verbatim.opm
index 121ec0698e6..e0f86c810e2 100644
--- a/Master/texmf-dist/tex/luatex/optex/verbatim.opm
+++ b/Master/texmf-dist/tex/luatex/optex/verbatim.opm
@@ -2,31 +2,49 @@
\_codedecl \begtt {Verbatim <2020-02-14>}
-%> parameters
+ \_doc ----------------------------
+ The internal parameters for verbatim macros are set.
+ \_cod ----------------------------
-\_newdimen\_ttindent \_ttindent=\_parindent % indentation in \begtt...\endtt and \verbinput
\_def\_ttskip{\_medskip} % space above and below \begtt, \verbinput
\_mathchardef\_ttpenalty=100 % penalty between lines in \begtt, \verbinput
-
-\_newcount\_ttline \_ttline=-1 % last line number in \begtt...\endtt
\_newcount\_viline % last line number in \verbinput
\_newread\_vifile % file fgiven by \verinput
-\_newtoks\_tthook % tokens procesed in \begtt...\endtt
-\_newtoks\_intthook % toens procesed in \code or in `...`
-\_public \ttline \tthook \intthook ;
+ \_doc ----------------------------
+ `\code{<text>}` expands to `\detokenize{<text>}` when `\escapechar=-1`. In
+ order to do it more robust when it is used in `\write` then it expands as
+ noexpanded `\code<space>` (followed by space in its csname). This macro
+ does the real work.
+
+ The `\_printinverbatim{<text>}` macro is used for `\code{<text>}` printing and for
+ \code{`}<text>\code{`} printing. It is defined as `\_hbox`, so the in-verbatim <text>
+ will be never broken. But you can re-define this macro.
-%> \code
+ When `\code` occurs in PDF outlines then it does the same as `\detokenize`.
+ The macro for preparing outlines sets `\escapechar` to $-1$ and uses
+ `\_regoul` token list before `\edef`.
+
+ The `\code` is not `\_proteced` because we want that it expands to
+ `\_unexpanded{\code<space>{<text>}}` in `\write` parameters. This protect the
+ expansions of the `\code` parameter (like `\\`, `\^` etc.).
+ \_cod ----------------------------
\_def\_code#1{\_unexpanded\_ea{\_csname _code \_endcsname{#1}}}
-\_protected\_sdef{_code }#1{{\_escapechar=-1 \_tt \_the\_intthook \_relax
+\_protected\_sdef{_code }#1{{\_escapechar=-1 \_tt \_the\_everyintt \_relax
\_ea\_printinverbatim\_ea{\_detokenize{#1}}}}
\_def\_printinverbatim#1{\_leavevmode\_hbox{#1}}
-\_toksapp \_pdfstringout{\_let\code=\_detokenize \_let\_code=\_detokenize}
+\_regmacro {}{}{\_let\code=\_detokenize \_let\_code=\_detokenize}
+
\_public \code ;
-%> \_setverb
+ \_doc ----------------------------
+ The `\_setverb` macro sets all catcodes to \"verbatim mode". It should be used only
+ in a group, so we prepare a new catcode table with \"verbatim" catcodes and we define
+ it as `\_catcodetable\_verbatimcatcodes`. After the group is finished then
+ original catcode table is restored.
+ \_cod ----------------------------
\_newcatcodetable \_verbatimcatcodes
\_def\_setverb{\_begingroup
@@ -38,18 +56,69 @@
\_setverb
\_def\_setverb{\_catcodetable\_verbatimcatcodes }%
-%> \activettchar
+ \_doc ----------------------------
+ `\activettchar<char>` saves original catcode of previously declared <char> (if
+ such character was declared) from `\_savedttchar` and `\_savedttcharc`
+ values. Then new such values are stored. The declared charater 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 `\_readverb` macro. Finally it prints scanned
+ <text> by `\_printinverbatim` and closes group. Suppose that `\activettchar"` is
+ used. Then the following work is schematically done:
+ \begtt
+ \_def "{\_begingroup \_setverb ... \_readverb}
+ \_def \_readverb #1"{\_printinverbatim{#1}\_endgroup}
+ \endtt
+ Note that the second occurence of `"` is not active because `\_setverb`
+ deactivates it.
+ \_cod ----------------------------
\_def\_activettchar#1{%
\_ifx\_savedttchar\_undefined\_else \_catcode\_savedttchar=\_savedttcharc \_fi
\_chardef\_savedttchar=`#1
\_chardef\_savedttcharc=\_catcode`#1
- \_adef{#1}{\_begingroup \_setverb \_adef{ }{\ }\_tt \_the\_intthook\_relax \_readverb}%
+ \_adef{#1}{\_begingroup \_setverb \_adef{ }{\ }\_tt \_the\_everyintt\_relax \_readverb}%
\_def\_readverb ##1#1{\_printinverbatim{##1}\_endgroup}%
}
\_public \activettchar ;
-%> \begtt ... \endtt
+ \_doc ----------------------------
+ `\begtt` id defined only as public. We don't need private `\_begtt` variant.
+ This macro os defined by `\eoldef`, so user can put an parameter at the
+ same line where `\begtt` is. This `#1` parameter is used after `\_everytt`
+ parameters settings, so user can change it locally.
+
+ The `\begtt` macro opens group, does `\_setverb` and another preprocessing, sets
+ `\endlinechar` to `^^J` and reads the following text in verbatim mode
+ until `\endtt` occurs. This scanning is done by `\_startverb` macro which is
+ defined as:
+ \begtt
+ \_def\_startverb #1\endtt #2^^J{...}
+ \endtt
+ We must to ensure that the backslash in `\endtt` has category 12 (this is a
+ reason of the `\ea` chain in real code).
+ The `#2` is something between `\endtt` and end of line and it is simply
+ ignored.
+
+ The `\startverb` puts the scanned data to `\_prepareverbdata`. It sets the data
+ to `\_tmpb` without changes by default, but you should re-define it in order
+ to does s special changes (for example colorization of the code), if you
+ want. The scanned data have `^^J` at each end of line and all spaces are
+ active characters. Other characters have nomal category 11 or 12.
+
+ When `\prepareverbdata` finishes then `\startverb` runs `\_printverb` loop
+ over aech line of the data and does a final work: last skip plus `\noindent`
+ without first indentation box. This trick keeps horizontal mode without
+ indentation when the empty line after `\endtt` does not exists. But it stops
+ horizontal mode without any new box in outer vertical mode if `\par` is
+ processed immediately after `\endtt`.
+
+ The `\_printverb` macro calls `\_printverbline{<line>}` to each scanned line of
+ verbatim text. This macro expect that it strarts in vertical mode ant it must
+ do `\par` in order to return the vertical mode. The `\_printverblinenum`
+ is used here: it does nothing when `\_ttline<0` else it prints the line
+ number using `\_llap`.
+ \_cod ----------------------------
\_eoldef \begtt#1{\_par \_wipeepar
\_begingroup
@@ -57,7 +126,7 @@
\_setverb
\_ifnum\_ttline<0 \_let\_printverblinenum=\_relax \_else \_initverblinenum \_fi
\_adef{ }{\ }\_parindent=\_ttindent \_parskip=0pt
- \_the\_tthook #1\_relax \_tt
+ \_the\_everytt \_relax #1\_relax \_tt
\_endlinechar=`^^J
\_startverb
}
@@ -80,7 +149,19 @@
\_def\_initverblinenum{\_tenrm \_thefontscale[700]\_ea\_let\_ea\_sevenrm\_the\_font}
\_def\_printverblinenum{\_global\_advance\_ttline by1 \_llap{\_sevenrm \_the\_ttline\_kern.9em}}
-%> \verbinput
+ \_doc ----------------------------
+ Macro `\verbinput` uses a file read perviously or opens the given file. Then
+ it runss the parameter scanning by `\_viscanparameter` and `\_viscanminus`.
+ Finally the `\_doverbinput` is run. At begining of `\_doverbinput` we have
+ `\_viline`= number of lines already read using previous `\verbinput`,
+ `\_vinolines`= the number of lines we need to skip and `\_vidolnes`= the
+ number of lines we need to print.
+ After group is opened then similar preparation is done as in `\begtt`. Then
+ we skip `\_nolines` lines in a loop a and we read `\_dolines` lines. The
+ read data is accumulated into `\_tmpb` macro. The next steps are equal to
+ the steps done in `\_startverb` macro: data are processed via
+ `\_prepareverbdata` and printed via `\_printverb` loop.
+ \_cod \_fin ----------------------
\_def\_verbinput (#1) #2 {\_par \_def\_tmpa{#2}%
\_ifx\_vifilename\_tmpa \_else
@@ -132,7 +213,7 @@
\_begingroup
\_ifnum\_ttline<-1 \_let\_printverblinenum=\_relax \_else \_initverblinenum \_fi
\_setverb \_adef{ }{\ }\_parindent=\_ttindent \_parskip=0pt
- \_the\_tthook\_relax \_tt
+ \_the\_everytt\_relax \_tt
\_endlinechar=`^^J \_tmpnum=0
\_loop \_ifeof\_vifile \_tmpnum=\_vinolines\_space \_fi
\_ifnum\_tmpnum<\_vinolines\_space
@@ -160,113 +241,5 @@
\_public
\verbinput ;
-
-\_endcode %---------------------------------------
-
-\secc Implementation notes
-
-\%> parameters
-
-The parameters for verbatim macros are set. `\ttline` is set to $-1$ by
-default, so `\begtt...\endtt` are not numbered but `\verbinput` are with
-numbers.
-
-\%> \code
-
-`\code{<text>}` expands to `\detokenize{<text>}` when `\escapechar=-1`. In
-order to do it more robust when it is used in `\write` then it expands as
-noexpanded `\code<space>` (followed by space in its csname). This macro doew
-really the work.
-
-The `\_printinverbatim{<text>}` macro is used for `\code{<text>}` printing and for
-\code{`}<text>\code{`} printing. It is defined as `\_hbox`, so the in-verbatim <text>
-will be never broken. But you can re-define this macro.
-
-When `\code` occurs in PDF outlines then it does the same as `\detokenize`.
-The macro for preparing outlines sets `\escapechar` to $-1$ and uses
-\_pdftringout` token list before `\edef`.
-
-The `\code` is not `\_proteced` because we want that it expands to
-`\_unexpanded{\code<space>{<text>}` in `\write` parameters. This protect the
-expansions of the `\code` parameter (like `\\`, `\^` etc.).
-
-\%> \_setverb
-
-The `\_setverb` macro sets all catcodes to \"verbatim mode". It should be used only
-in a group, so we prepare a new catcode table with \"verbatim" catcodes and we define
-it as `\_catcodetable\_verbatimcatcodes`. After the group is finished then
-original catcode table is restored.
-
-\%> \activettchar
-
-This macro saves original catcode of previously declared `\catcodettchar` (if
-such character was decalred) from `\_savedttchar` and `\_savedttcharc`
-values. Then new such values are stored. The declared charater 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 `\_readverb` macro. Finally it prints scanned
-<text> by `\_printinverbatim` and closes group. Suppose that `\activettchar"` is
-used. Then the following work is schematically done:
-
-\begtt
-\_def "{\_begingroup \_setverb ... \_readverb}
-\_def \_readverb #1"{\_printinverbatim{#1}\_endgroup}
-\endtt
-%
-Note that the second occurence of `"` is not active because `\_setverb`
-deactivates it.
-
-\%> \begtt ... \endtt
-
-`\begtt` id defined only as public. We don't need private `\_begtt` variant.
-This macro os defined by `\eoldef`, sot user can put an parameter at the
-same line where `\begtt` is. This `#1` parameter is used after globap
-parameters settings, so user can change it locally.
-
-The `\begtt` macro opens group, does `\_setverb` and another preprocessing, sets
-`\endlinechar` to `^^J` and reads the following text in verbatim mode
-until `\endtt` occurs. This scanning is done by `\_startverb` macro which is
-edfined as:
-
-\begtt
-\_def\_startverb #1\endtt #2^^J{...}
-\endtt
-%
-We must to ensure that the backslash in `\endtt` has category 12 (this is a
-reason of the `\ea` chain in real code).
-The `#2` is something between `\endtt` and end of line and it is simply
-ignored.
-
-The `\startverb` puts the scanned data to `\_prepareverbdata`. It sets the data
-to `\_tmpb` without changes by default, but you should re-define it in order
-to does s special changes (for example colorization of the code), if you
-want. The scanned data have `^^J` at each end of line and all spaces are
-active characters. Other characters have nomal category 11 or 12.
-
-When `\prepareverbdata` finishes then `\startverb` runs `\_printverb` loop
-over aech line of the data and does a final work: last skip plus `\noindent`
-without first indentation box. This trick keeps horizontal mode without
-indentation when the empty line after `\endtt` does not exists. But it stops
-horizontal mode without any new box in outer vertical mode if `\par` is
-processed immediately after `\endtt`.
-
-The `\_printverb` macro calls `\_printverbline{<line>}` to each scanned line of
-verbatim text. This macro expect that it strarts in vertical mode ant it must
-do `\par` in order to return the vertical mode. The `\_printverblinenum`
-is used here: it does nothing when `\_ttline<0` else it prints the line
-number using `\_llap`.
-
-\%> \verbinput
-
-Macro `\verbinput` uses a file read perviously or opens the given file. Then
-it runss the parameter scanning by `\_viscanparameter` and `\_viscanminus`.
-Finally the `\_doverbinput` is run. At begining of `\_doverbinput` we have
-`\_viline`= number of lines already read using previous `\verbinput`,
-`\_vinolines`= the number of lines we need to skip and `\_vidolnes`= the
-number of lines we need to print.
-After group is opened then similar preparation is done as in `\begtt`. Then
-we skip `\_nolines` lines in a loop a and we read `\_dolines` lines. The
-read data is accumulated into `\_tmpb` macro. The next steps are equal to
-the steps done in `\_startverb` macro: data are processed via
-`\_prepareverbdata` and printed via `\_printverb` loop.
+\_endcode