diff options
Diffstat (limited to 'macros/optex')
24 files changed, 210 insertions, 67 deletions
diff --git a/macros/optex/README b/macros/optex/README index ac77358913..bd8d5824e8 100644 --- a/macros/optex/README +++ b/macros/optex/README @@ -19,6 +19,10 @@ doc/ ... PDF version of the OpTeX documentation and sources. History: +<1.05> Jan. 2022: + \_par used internally instead \par if \partokenname is available. + Extended format \ref[label]{text} and \pgref[label]{text} introduced. + Fixed a few bugs. <1.04> Aug. 2021: Color handling reimplemented, LuaTeX's attributes are used now. Loading Unicode math fonts reimplemented, (s)script size given by font. diff --git a/macros/optex/base/basic-macros.opm b/macros/optex/base/basic-macros.opm index 912be5e036..2e8c98d6e3 100644 --- a/macros/optex/base/basic-macros.opm +++ b/macros/optex/base/basic-macros.opm @@ -106,7 +106,7 @@ \_cod ------------------------------ \_def\_loggingall{\_tracingcommands=3 \_tracingstats=2 \_tracingpages=1 - \_tracingoutput=1 \_tracinglostchars=1 \_tracingmacros=3 + \_tracingoutput=1 \_tracingmacros=3 % \_tracinglostchars=2 is already set \_tracingparagraphs=1 \_tracingrestores=1 \_tracingscantokens=1 \_tracingifs=1 \_tracinggroups=1 \_tracingassigns=1 } \_def\_tracingall{\_tracingonline=1 \_loggingall} diff --git a/macros/optex/base/doc.opm b/macros/optex/base/doc.opm index 34a00dc1e9..cb2b976e7c 100644 --- a/macros/optex/base/doc.opm +++ b/macros/optex/base/doc.opm @@ -134,7 +134,7 @@ \_ifx\_printfilename\_relax \_penalty \_ttpenalty \_fi \_vskip-4pt \_noindent\_rlap{\Yellow \_vrule height8pt depth5pt width\_hsize}% \_printfilename - \_indent \_printverblinenum #1\par} + \_indent \_printverblinenum #1\_par} \_def\_printfilename{\_hbox to0pt{% \_hskip\_hsize\_vbox to0pt{\_vss\_llap{\Brown\docfile}\_kern7.5pt}\_hss}% diff --git a/macros/optex/base/fnotes.opm b/macros/optex/base/fnotes.opm index 62912d0400..661d54c33f 100644 --- a/macros/optex/base/fnotes.opm +++ b/macros/optex/base/fnotes.opm @@ -129,12 +129,13 @@ The \`\_mnoteD``{<text>}` macro sets the position of the marginal note. 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. + as a box shifted down by `\parskip` and with `\vskip-\baselineskip` followed. \_cod ----------------------------- \_def\_mnote #1#{\_ifx^#1^\_else \_mnoteC#1\_end \_fi \_mnoteD} \_def\_mnoteC up#1\_end{\_mnoteskip=#1\_relax} % \mnote up<dimen> {<text>} syntax -\_long\_def\_mnoteD#1{\_ifvmode {\_mnoteA{#1}}\_nobreak\_vskip-\_baselineskip \_else +\_long\_def\_mnoteD#1{% + \_ifvmode \_vskip\_parskip{\_mnoteA{#1}}\_nobreak\_vskip-\_baselineskip\_vskip-\_parskip \_else \_lower\_dp\_strutbox\_hbox{}\_vadjust{\_kern-\_dp\_strutbox \_mnoteA{#1}\_kern\_dp\_strutbox}% \_fi } diff --git a/macros/optex/base/fonts-select.opm b/macros/optex/base/fonts-select.opm index 355a71a191..d8d3982ba6 100644 --- a/macros/optex/base/fonts-select.opm +++ b/macros/optex/base/fonts-select.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \fontfam {Fonts selection system <2021-07-16>} % preloaded in format +\_codedecl \fontfam {Fonts selection system <2021-09-24>} % preloaded in format \_doc ----------------------------- The variant selectors \^`\rm`, \^`\bf`, \^`\it`, \^`\bi`, \^`\tt` @@ -175,7 +175,7 @@ \_cod ----------------------------- \_def\_famdecl [#1]#2#3#4#5#6#7#8{% - \_initunifonts \_uniaccents + \_initunifonts \_unichars \_uniaccents \_unless\_ifcsname _f:\_csstring#2:main.fam\_endcsname \_isfont{#7}\_iffalse \_opwarning{Family [#1] skipped, font "#7" not found}\_ea\_ea\_ea\_endinput \_else @@ -1011,6 +1011,7 @@ Luaotfload documentation for more information. \endinput +2021-09-24 \_unichars used in \initunifonts 2021-07-16 \initunifonts: optex_hook_into_luaotfload added. 2021-05-23 concept of \_fontfeatures macro re-implemented 2021-05-02 simpler \_resizefont, better concept of doc, moving parts from fonts-resize diff --git a/macros/optex/base/hyperlinks.opm b/macros/optex/base/hyperlinks.opm index ef205f3aa2..4c2007cddb 100644 --- a/macros/optex/base/hyperlinks.opm +++ b/macros/optex/base/hyperlinks.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \ulink {Hyperlinks <2021-05-14>} % preloaded in format +\_codedecl \ulink {Hyperlinks <2021-08-31>} % preloaded in format \_doc ---------------------------- \`\dest``[<type>:<spec>]` creates a destination of internal links. The @@ -27,19 +27,19 @@ \_doc ---------------------------- Each hyperlink is created internally by \`\_xlink``{<type>}{<spec>}{<color>}{<text>}`. This macro expands to `\_quitvmode{<text>}` by default, i.e.\ no active - hyperlink is created, only <text> is printed in horizontal mode. - If \^`\hyperlinks` is used, then `\_xlink` gets meaning of - \`\_xlinkactive` and hyperlinks are created using `\pdfstartlink`, + hyperlink is created, only <text> is printed in horizontal mode (and in a group). + If \^`\hyperlinks` is used, then `\_xlink` gets the meaning of + \`\_xlinkactive` and hyperlinks are created by the `\pdfstartlink`/% `\pdfendlink` primitives. The <text> has given <color> only when - hyperlink is created. But if `\_<type>linkcolor` is defined, it has - precedence. + hyperlink is created. If `\_<type>linkcolor` is defined, it has + precedence over <color>. \nl The \`\_linkdimens` macro declares the dimensions of link area. \nl A specific action can be defined for each link <type> by the macro `\_<type>action{<spec>}`. \OpTeX/ defines only \`\_urlaction``{<url>}`. The default link action (when `\_<type>action` is not defined) is - `goto mame{<type>:<spec>}` (creates an internal link). It is declared in the + `goto name{<type>:<spec>}` (an internal link). It is declared in the \`\_linkactions``{<type>}{<spec>}` macro. \nl The `\_pdfstartlink` primitive uses `attr{\_pdfborder{<type>}}`. The @@ -91,14 +91,15 @@ \_public \ilink \ulink \link ; \_doc ---------------------------- - \`\hyperlinks``{<ilink_color>}{<ulink_color>}` activates `\dest`, `\xlink`, - in order they create links. + \`\hyperlinks``<ilink color><ulink color>` activates `\dest`, `\xlink`, + so that they create links. Not setting colors (`\hyperlinks{}{}`) is also + supported. \_cod ---------------------------- \_def\_hyperlinks#1#2{% \_let\_dest=\_destactive \_let\_xlink=\_xlinkactive - \_let\_ilinkcolor=#1% - \_let\_elinkcolor=#2% + \_let\_ilinkcolor=#1\_empty + \_let\_elinkcolor=#2\_empty \_public \dest \xlink ;% } \_public \hyperlinks ; @@ -201,6 +202,7 @@ Another example `\def\_tocborder{1 0 0}` causes red frames in TOC \_endinput +2021-08-31 \hyperlinks{}{} allowed, bug fixed 2021-05-14 \_xlink introduced, \link, \ilink, \ulink re-implemented. 2021-05-12 \url: triplet :// instead //, \_urlslashslash removed. 2021-05-11 \url reimplemented, \_urlxskip added. diff --git a/macros/optex/base/languages.opm b/macros/optex/base/languages.opm index 19b1813edd..26e0c62628 100644 --- a/macros/optex/base/languages.opm +++ b/macros/optex/base/languages.opm @@ -37,7 +37,7 @@ \_langw cs Kapitola Tabulka Obrázek Věc \_langw de Kapitel Tabelle Abbildung Betreff \_langw es Capítulo Tabla Figura Sujeto -\_langw fr Chaptire Tableau Figure Matière +\_langw fr Chapitre Tableau Figure Matière \_langw it Capitolo Tabella Fig. Oggetto \_langw pl Rozdział Tabela Ilustracja Temat \_langw gr Κεφάλαιο Πίνακας Σχήμα θέμα diff --git a/macros/optex/base/multicolumns.opm b/macros/optex/base/multicolumns.opm index 1a32db62b7..f048963043 100644 --- a/macros/optex/base/multicolumns.opm +++ b/macros/optex/base/multicolumns.opm @@ -31,7 +31,7 @@ \_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\_par{\_ifhmode\_endgraf\_global\_advance\_mullines by\_prevgraf\_fi}% } \_def\_endmulti{\_vskip-\_prevdepth\_vfil \_ea\_egroup\_ea\_egroup\_ea\_baselineskip\_the\_baselineskip\_relax diff --git a/macros/optex/base/optex.ini b/macros/optex/base/optex.ini index e51a8824df..4ccc482d8f 100644 --- a/macros/optex/base/optex.ini +++ b/macros/optex/base/optex.ini @@ -21,7 +21,7 @@ % OpTeX version -\def\optexversion{1.04 Aug.2021} +\def\optexversion{1.05 Jan.2022} \def\fmtname{OpTeX} \let\fmtversion=\optexversion diff --git a/macros/optex/base/optex.lua b/macros/optex/base/optex.lua index 5114ea21e9..19eeb6328b 100644 --- a/macros/optex/base/optex.lua +++ b/macros/optex/base/optex.lua @@ -419,12 +419,17 @@ end, "_tracingmacros") -- inject PDF literals according to attributes. -- local node_id = node.id +local node_subtype = node.subtype local glyph_id = node_id("glyph") local rule_id = node_id("rule") local glue_id = node_id("glue") local hlist_id = node_id("hlist") local vlist_id = node_id("vlist") local disc_id = node_id("disc") +local whatsit_id = node_id("whatsit") +local pdfliteral_id = node_subtype("pdf_literal") +local pdfsave_id = node_subtype("pdf_save") +local pdfrestore_id = node_subtype("pdf_restore") local token_getmacro = token.get_macro local direct = node.direct @@ -517,6 +522,10 @@ local function is_color_needed(head, n, id, subtype) -- returns non-stroke, stro return true, true end return true, false + elseif id == whatsit_id and (subtype == pdfliteral_id + or subtype == pdfsave_id + or subtype == pdfrestore_id) then + return true, true end return false, false end diff --git a/macros/optex/base/others.opm b/macros/optex/base/others.opm index a6dc2064eb..0c9f4cae6a 100644 --- a/macros/optex/base/others.opm +++ b/macros/optex/base/others.opm @@ -80,15 +80,15 @@ usages of `\lipsum` are fully expandable. If you want to have all printings of `\lipsum` expandable, use dummy `\lipsum[0]` first. - `\lipsum` adds `\par` after each printed paragraph. If you don't need - such `\par` here, use \`\lipsumtext``[<number>]`. - This macro prints only one selected paragraph <number> and does not add `\par`. + `\lipsum` adds `\_par` after each printed paragraph. If you don't need + such `\_par` here, use \`\lipsumtext``[<number>]`. + This macro prints only one selected paragraph <number> and does not add `\_par`. \_cod ---------------------------- \_def\_lipsumtext[#1]{\_lipsumload\_cs{_lip:#1}} \_def\_lipsum[#1]{\_lipsumA #1\_empty-\_empty\_end} \_def\_lipsumA #1-#2\_empty#3\_end{% - \_fornum #1..\_ifx^#2^#1\_else#2\_fi \_do {\_lipsumtext[##1]\par}} + \_fornum #1..\_ifx^#2^#1\_else#2\_fi \_do {\_lipsumtext[##1]\_par}} \_def\_lipsumload{{% \_setbox0=\_vbox{\_tmpnum=0 % vertical mode during \input lipsum.ltd.tex \_def\ProvidesFile##1[##2]{}% @@ -100,6 +100,78 @@ \_public \lipsum \lipsumtext ; \_let \lorem=\lipsum + \_doc ----------------------------- + Lua\TeX/ version 1.14 and newer provides `\partokenname` which allows to + specify something different than `\par` at empty lines. We set `\_par` + (see bellow) in \OpTeX/ version 1.04+ and newer. Some macros were rewritten + due to this change. And we copy old versions of these changed macros here + in order to allow to use older Lua\TeX/ versions where `\partokenname` is + not provided.\nl + Note that your macros where a parameter is separated by the empty line + must be changed too. Use `\def\macro #1\_par{...}` instead + `\def\macro #1\par{...}`. + \_cod ----------------------------- + +\_ifx\_partokenname\_undefined % LuaTeX 1.13 or older: + + \_def\_begmulti #1 {\_par\_bgroup\_wipeepar\_multiskip\_penalty0 \_def\_Ncols{#1} + \_setbox6=\_vbox\_bgroup\_bgroup \_let\_setxhsize=\_relax \_penalty-99 + \_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\_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}}% + \_ea\_the \_csname _everycaption\_tmpa\_endcsname + \_def\_par{\_nbpar\_egroup}\_let\par=\_par + \_cs{_printcaption\_tmpa}% + } + \_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\_letter{ + \_def\_address{\_vtop\_bgroup\_boxlines \_parskip=0pt \_let\par=\_egroup} + \_def\_subject{{\_bf \_mtext{subj}: }} + \_public \address \subject ; + \_typosize[11/14] + \_vsize=\_dimexpr \_topskip + 49\_baselineskip \_relax % added 2020-03-28 + \_parindent=0pt + \_parskip=\_medskipamount + \_nopagenumbers + } + \_def\_printverbline#1{\_putttpenalty \_indent \_printverblinenum \_kern\_ttshift #1\par} + \_public \begmulti \boxlines \letter ; + +\_else % LuaTeX 1.14 or newer: + + \_doc ----------------------------- + We set `\partokenneame` to `\_par` in order to keep the name `\par` in + user name space. I.e. a user can say `\def\par{paragraph}` for example + without crash of processing the document. Se section~\ref[prefixed] for + more details about the name space concept.\nl + Moreover, we set `\partokencontext` to one in order to the `\_par` token + is inserted not only at empty lines, but also at the end of `\vbox`, `\vtop` and + `\vcenter` if horizontal mode is opened here. This differs from default + \TeX/ behavior where horizontal mode is closed in these cases without + inserting par token.\nl + We set \`\_partokenset` to defined value 1 in order to the macro programmer can + easily check these settings in \OpTeX/ format by + `\ifx\_partokenset\undefined ... \else ...\fi`. + \_cod ----------------------------- + + \_partokenname\_par + \_partokencontext=1 + \_let\_partokenset=1 +\_fi + \_endcode 2021-08-02 \SetLipsumLanguage added, fix for new lipusm version diff --git a/macros/optex/base/plain-macros.opm b/macros/optex/base/plain-macros.opm index b878d96ce8..2f4d2da65c 100644 --- a/macros/optex/base/plain-macros.opm +++ b/macros/optex/base/plain-macros.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \magstep {Macros from plain TeX <2021-04-09>} % preloaded in format +\_codedecl \magstep {Macros from plain TeX <2021-09-24>} % preloaded in format \_doc ----------------------------- The \`\dospecials` works like in plain TeX but does nothing with `_`. @@ -48,11 +48,11 @@ Plain \TeX/ classical \`\obeylines` and \`\obeyspaces`. \_cod ----------------------------- -% In \obeylines, we say `\let^^M=\par' instead of `\def^^M{\par}' -% since this allows, for example, `\let\par=\cr \obeylines \halign{...' +% In \obeylines, we say `\let^^M=\_par' instead of `\def^^M{\_par}' +% since this allows, for example, `\let\_par=\cr \obeylines \halign{...' {\_catcode`\^^M=13 % these lines must end with % \_gdef\_obeylines{\_catcode`\^^M=13\_let^^M\_par}% - \_global\_let^^M=\par} % this is in case ^^M appears in a \write + \_global\_let^^M=\_par} % this is in case ^^M appears in a \write \_def\_obeyspaces{\_catcode`\ =13 } {\_obeyspaces\_global\_let =\_space} \_public \obeylines \obeyspaces ; @@ -210,8 +210,7 @@ \_def\_{\_hbox{_}} \_def\dag{\_errmessage{\_usedirectly †}} \_def\ddag{\_errmessage{\_usedirectly ‡}} -%\_def\copyright{\_errmessage{\_usedirectly ©}} -\_def\copyright{©} % << example, what to do +\_def\copyright{\_errmessage{\_usedirectly ©}} %\_def\Orb{\_mathhexbox20D} % obsolete (part of Copyright) %\_def\P{\_mathhexbox27B} % obsolete @@ -220,6 +219,21 @@ \_public \mathhexbox ; \_doc ----------------------------- + The \`\_unichars` macro is run in \^`\initunifonts`, + Unicodes are used instead old plain \TeX/ settings. + \_cod ----------------------------- + +\def\_unichars{% characters with different codes in Unicode: + \_chardef\ss=`ß + \_chardef\oe=`œ + \_chardef\OE=`Œ + \_chardef\S=`§ + \_chardef\dag`† + \_chardef\ddag`‡ + \_chardef\copyright`© +} + + \_doc ----------------------------- Accents. The macros \`\ooalign`, \`\d`, \`\b`, \`\c`, \`\dots`, are defined for backward compatibility. @@ -344,5 +358,6 @@ \_endcode % ------------------------------------- +2021-09-24 ... \_unichars introduced 2021-04-09 ... \_public\showhyphens, bug fixed 2020-02-14 ... released diff --git a/macros/optex/base/prefixed.opm b/macros/optex/base/prefixed.opm index 6dec64c7e5..d15ee4140d 100644 --- a/macros/optex/base/prefixed.opm +++ b/macros/optex/base/prefixed.opm @@ -175,12 +175,12 @@ In this documentation: if both variants of a control sequence are declared the unprefixed variant. The code typically defines the prefixed variant and then the \^`\public` (or `\_public`) macro is used. -\secc Namespace of control sequences for users +\secc[user-ns] Namespace of control sequences for users -Users can define or declare any control sequence with a name without any `_`. -This does not make any problem. Only one exception is the reserved control -sequence `\par`. It is generated by the tokenizer (at empty lines) -and used as internal in \TeX/. +Users can (re)define or (re)declare any control sequence with a name without any `_`. +This does not make any problem in internal \OpTeX/ macros.\fnote +{The token `\par` is in user name space too from \OpTeX/ 1.04+ and +Lua\TeX/ 1.14, see also the end of section~\ref[others].} User can define or declare control sequences with `_` character, for example `\my_control_sequence`, but with the following exceptions: diff --git a/macros/optex/base/references.opm b/macros/optex/base/references.opm index eb884c4f1d..51b1b9591a 100644 --- a/macros/optex/base/references.opm +++ b/macros/optex/base/references.opm @@ -24,11 +24,10 @@ \_doc ---------------------------- \`\_Xlabel` `{<label>}{<text>}` saves the <text> to `\_lab:<label>` and saves - `[pg:<gpageno>]{<pageno>}` to `\_pgref:<label>`. + `{<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}} +\_def\_Xlabel#1#2{\_sdef{_lab:#1}{#2}\_sxdef{_pgref:#1}{\_currpage}} \_doc ---------------------------- \`\label``[<label>]` saves the declared label to `\_lastlabel` and @@ -54,31 +53,52 @@ \_public \label \wlabel ; \_doc ---------------------------- - \`\ref``[<label>]` uses saved `\_lab:<label>` and prints (linked) `<text>`. + \`\ref``[<label>]{<given-text>}` prints (linked) `<given-text>`. + The missing optional `{<given-text>}` is replaced by `{@}`. The `@` is + replaced by `<implicit-text>` from saved `\lab:<label>` using \^`\_reftext` macro. If the reference is backward 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 the first run of \TeX/ and we print a warning and do `\_openref`. \nl - \`\pgref``[<label>]` uses `{<gpageno>}{<pageno>}` from `\_pgref:<label>` and - prints (linked) `<pageno>` using `\_ilink` macro. + \`\pgref``[<label>]{<given-text>}` prints `<given-text>` where `@` is + replaced by <pageno>. Data in the format `{<gpageno>}{<pageno>}` + are read from `\_pgref:<label>` by \`\_pgrefB``{<gpageno>}{<pageno>}{<given-text>}`. + \nl + \`\_lastreflabel` keeps the value of the last label read by \^`\ref` or \^`\pgref`. + You can use it for example by definig a macro `\pg` by `\def\pg{\pgref[\_lastreflabel]}` + and then you need not repeat the same label in typical situations and you + can write for instance: `see section \ref[lab] at page \pg.` \_cod ---------------------------- -\_def\_ref[#1]{\_isdefined{_lab:#1}% - \_iftrue \_ilink[ref:#1]{\_csname _lab:#1\_endcsname}% - \_else ??\_opwarning{label [#1] unknown. Try to TeX me again}% - \_incr\_unresolvedrefs \_openref +\_def\_ref[#1]{\_xdef\_lastreflabel{#1}\_isnextchar\_bgroup{\_refA}{\_refA{@}}} +\_def\_refA #1{\_isdefined{_lab:\_lastreflabel}% + \_iftrue \_ilink[ref:\_lastreflabel]{\_reftext{\_csname _lab:\_lastreflabel\_endcsname}{#1}}% + \_else \_reftext{??}{#1}\_opwarning{label [\_lastreflabel] unknown. Try to TeX me again}% + \_incr\_unresolvedrefs \_openref \_fi } -\_def\_pgref[#1]{\_isdefined{_pgref:#1}% - \_iftrue \_ea\_ea\_ea\_ilink \_csname _pgref:#1\_endcsname - \_else ??\_opwarning{pg-label [#1] unknown. Try to TeX me again}% +\_def\_pgref[#1]{\_xdef\_lastreflabel{#1}\_isnextchar\_bgroup{\_pgrefA}{\_pgrefA{@}}} +\_def\_pgrefA #1{\_isdefined{_pgref:\_lastreflabel}% + \_iftrue \_ea\_ea\_ea\_pgrefB \_csname _pgref:\_lastreflabel\_endcsname{#1}% + \_else \_reftext{??}{#1}\_opwarning{pg-label [\_lastreflabel] unknown. Try to TeX me again}% \_incr\_unresolvedrefs \_openref \_fi } +\_def\_pgrefB #1#2#3{\_ilink[pg:#1]{\_reftext{#2}{#3}}} + \_public \ref \pgref ; \_doc ----------------------------- + \`\_reftext``{<implicit-text>}{<given-text>}` expands to the <given-text> + but the optional `@` in the `<given-text>` is replaced by the `<implicit-text>` first. + \_cod ----------------------------- + +\_def\_reftext #1#2{\_isatin #2@\_iffalse #2\_else\_reftextA{#1}#2\_end \_fi} +\_def\_reftextA #1#2@#3\_end {#2#1#3} +\_def\_isatin #1@#2\_iffalse {\_ifx\_end#2\_end} + + \_doc ----------------------------- Default \`\_printlabel` is empty macro (labels are not printed). The \`\showlabels` redefines it as box with zero dimensions and with left lapped `[<label>]` in blue 10pt `\tt` font shifted up by 1.7ex. diff --git a/macros/optex/base/sections.opm b/macros/optex/base/sections.opm index 39759962bf..25d31cabaa 100644 --- a/macros/optex/base/sections.opm +++ b/macros/optex/base/sections.opm @@ -331,7 +331,7 @@ edefines \`\_thecapnum` as `\_the<letter>num` and defines \`\_thecaptitle` as language-dependent word using \^`\_mtext`, runs the `\_everycaption<letter>` tokens register. - The group opened by `\caption` is finalized by first `\par` from + The group opened by `\caption` is finalized by first `\_par` from an empty line or from `\vskip` or from `\endinsert`. The `\_printcaption<letter>` is called, it starts with printing of the caption.\nl @@ -347,7 +347,7 @@ \_edef\_thecapnum {\_csname _the\_tmpa num\_endcsname}% \_edef\_thecaptitle{\_mtext{\_tmpa}}% \_ea\_the \_csname _everycaption\_tmpa\_endcsname - \_def\_par{\_nbpar\_egroup}\_let\par=\_par + \_def\_par{\_nbpar\_egroup}% \_cs{_printcaption\_tmpa}% } \_def \_cskip {\_par\_nobreak\_medskip} % space between caption and the object diff --git a/macros/optex/base/styles.opm b/macros/optex/base/styles.opm index deb47d6930..1c37339d02 100644 --- a/macros/optex/base/styles.opm +++ b/macros/optex/base/styles.opm @@ -18,7 +18,7 @@ \_def\_nl{\_boxlinesE}% \_bgroup \_lccode`\~=`\^^M\_lowercase{\_egroup\_let~}\_boxlinesE \_everypar{\_setbox0=\_lastbox\_endgraf - \_hbox\_bgroup \_catcode`\^^M=13 \_let\par=\_nl \_aftergroup\_boxlinesC}% + \_hbox\_bgroup \_catcode`\^^M=13 \_let\_par=\_nl \_aftergroup\_boxlinesC}% } \_def\_boxlinesC{\_futurelet\_next\_boxlinesD} \_def\_boxlinesD{\_ifx\_next\_empty\_else\_ea\_egroup\_fi} @@ -51,7 +51,7 @@ \_cod ----------------------------- \_def\_letter{ - \_def\_address{\_vtop\_bgroup\_boxlines \_parskip=0pt \_let\par=\_egroup} + \_def\_address{\_vtop\_bgroup\_boxlines \_parskip=0pt \_let\_par=\_egroup} \_def\_subject{{\_bf \_mtext{subj}: }} \_public \address \subject ; \_typosize[11/14] diff --git a/macros/optex/base/unimath-codes.opm b/macros/optex/base/unimath-codes.opm index d7f0d387ef..ea40116ab8 100644 --- a/macros/optex/base/unimath-codes.opm +++ b/macros/optex/base/unimath-codes.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \_ncharrmA {Uni math codes <2021-04-25>} % preloaded on demand by \loadmath +\_codedecl \_ncharrmA {Uni math codes <2022-01-06>} % preloaded on demand by \loadmath \_doc ----------------------------- The control sequences for `\alpha`, `\beta` etc are redefined here. @@ -216,6 +216,8 @@ \_Umathcode `* = 2 1 "02217 % equivalent to \ast, like in plain TeX +\_Umathcode "03A2 = 7 1 "03F4 % \varTheta + \_protected\_def \_sqrt {\_Uradical 1 "0221A } \_protected\_def \_cuberoot {\_Uradical 1 "0221B } \_protected\_def \_fourthroot {\_Uradical 1 "0221C } @@ -313,6 +315,8 @@ \_let \drbkarow=\drbkarrow \_let \hksearow=\hksearrow \_let \hkswarow=\hkswarrow +\_let \square=\mdlgwhtsquare +\_let \blacksquare=\mdlgblksquare \_let \upalpha=\mupalpha \_let \upbeta=\mupbeta @@ -439,6 +443,8 @@ for technical details about Unicode-math. \_endinput History: +2022-01-06 \varTheta corrected +2021-09-15 \square, \blacksquare defined 2021-04-25 \triangleright: typo fixed 2021-04-20 reading mathclass.opm improved 2021-04-07 \_setnabla introduced, \nabla as uppercase Greek letter diff --git a/macros/optex/base/verbatim.opm b/macros/optex/base/verbatim.opm index 08748eb5a6..e3d423691e 100644 --- a/macros/optex/base/verbatim.opm +++ b/macros/optex/base/verbatim.opm @@ -176,7 +176,7 @@ \_ifx\_end#2 \_let\_next=\_relax \_else \_def\_next{\_printverb#2}\_fi \_next } -\_def\_printverbline#1{\_putttpenalty \_indent \_printverblinenum \_kern\_ttshift #1\par} +\_def\_printverbline#1{\_putttpenalty \_indent \_printverblinenum \_kern\_ttshift #1\_par} \_def\_initverblinenum{\_tenrm \_thefontscale[700]\_ea\_let\_ea\_sevenrm\_the\_font} \_def\_printverblinenum{\_llap{\_sevenrm \_the\_ttline\_kern.9em}} \_def\_putttpenalty{\_def\_putttpenalty{\_penalty\_ttpenalty}} diff --git a/macros/optex/doc/omls.tex b/macros/optex/doc/omls.tex index 5c21fd5671..a7ac9edd01 100644 --- a/macros/optex/doc/omls.tex +++ b/macros/optex/doc/omls.tex @@ -44,7 +44,12 @@ %\ttindent=0pt \everylist={\advance\ttindent by-1em} \hyperlinks \Green \Green -\def\cskip{\par\nobreak} +\ifx\_partokenset\undefined + \def\cskip{\par\nobreak} +\else + \def\cskip{\_par\nobreak} +\fi + \def\begblock{\medskip\hbox\bgroup\vrule\vbox\bgroup\hrule\smallskip \_fnset\leftskip=\parindent \rightskip=\parindent \medskip\noindent} \def\endblock{\medskip\hrule\egroup\vrule\egroup} diff --git a/macros/optex/doc/optex-doc.pdf b/macros/optex/doc/optex-doc.pdf Binary files differindex 910019b5d9..85260e0fdc 100644 --- a/macros/optex/doc/optex-doc.pdf +++ b/macros/optex/doc/optex-doc.pdf diff --git a/macros/optex/doc/optex-doc.tex b/macros/optex/doc/optex-doc.tex index f8cb192d86..1c9af23aa9 100644 --- a/macros/optex/doc/optex-doc.tex +++ b/macros/optex/doc/optex-doc.tex @@ -21,7 +21,7 @@ \tit Format Based on Plain \TeX/ and OPmac\fnotemark1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\hfill Version 1.04 +\hfill Version 1.05 \centerline{\it Petr Olšák, 2020, 2021} diff --git a/macros/optex/doc/optex-math.tex b/macros/optex/doc/optex-math.tex index 5f590d5b25..4c9d5dd01f 100644 --- a/macros/optex/doc/optex-math.tex +++ b/macros/optex/doc/optex-math.tex @@ -859,9 +859,12 @@ stretchability in the `\>` space, and more stretchability in the `\;` space. The registers \x`\thinmuskip`, \x`\medmuskip`, and \x`\thickmuskip` store so-called \ii mu/values {\em mu values} given by math unit `mu`. It is 1/18 em and this unit depends on the current font size used in the math formula ($S$ or $SS$ styles use -smaller font size, the `mu` unit is smaller here). You can use \x`\muskip` -instead `\hskip` or \x`\mukern` instead `\kern` if you want to use this -special mu unit. It is allowed only in math mode. +smaller font size, the `mu` unit is smaller here). You can use \x`\mskip` +instead `\hskip` or \x`\mkern` instead `\kern` if you want to use this +special `mu` unit. It is allowed only in math mode. + +If \x`\nonscript` precedes `\hskip`, `\mskip`, `\kern`, or `\mkern` then this +space is applied only in $D$ or $T$ style. The \x`\quad` and \x`\qquad` spaces have fixed width and they can be used in text mode too. (\OpTeX/ allows to use `\,` in text mode too). diff --git a/macros/optex/doc/optex-techdoc.tex b/macros/optex/doc/optex-techdoc.tex index 4f94e8be70..1748e9f3ea 100644 --- a/macros/optex/doc/optex-techdoc.tex +++ b/macros/optex/doc/optex-techdoc.tex @@ -254,7 +254,7 @@ The `\margins` macro is documented in the section~\ref[marg]. \secc[langphrases] Multilingual phrases and quotation marks \printdoc languages.opm -\sec Other macros +\sec[others] Other macros Miscellaneous macros are here. \printdoc others.opm diff --git a/macros/optex/doc/optex-userdoc.tex b/macros/optex/doc/optex-userdoc.tex index 16fd468c1f..3fefc22657 100644 --- a/macros/optex/doc/optex-userdoc.tex +++ b/macros/optex/doc/optex-userdoc.tex @@ -564,7 +564,8 @@ if optional parameter `[<label>]` is appended to \^`\chap`, \^`\sec`, \^`\secc`, \^`\caption/t`, \^`\caption/f` or \^`\eqmark`. The alternative syntax is to use \^`\label[<label>]` before mentioned commands (not necessarily directly -before). The reference is realized by \^`\ref[<label>]` or \^`\pgref[<label>]`. +before). The reference is realized by \^`\ref[<label>]` (prints the number +of the referenced object) or \^`\pgref[<label>]` (prints the page number). Example: \begtt @@ -582,6 +583,13 @@ or write something about the equation~\ref[pythagoras]. Finally there is an interesting Table~\ref[comp-depend]. \endtt +The text printed by \^`\ref` or \^`\pgref` can be given explicitly by +\^`\ref[<label>]{<text>}` or \^`\pgref[<label>]{<text>}`. If the `<text>` +includes the `@` character, it is replaced by implicitly printed text. +Example: `see \ref[lab]{section~@}` prints the same as `see section~\ref[lab]`, +but first case creates larger active area for mouse clicking, when +\~`\hyperlinks` are declared. + If there are forward referenced objects then users have to run \TeX{} twice. During each pass, the working `*.ref` file (with references data) is created and this file is used (if it exists) at the beginning of the document. @@ -663,7 +671,7 @@ If the linked text have to be different than the URL, you can use `\ulink[http://petr.olsak.net/optex]{\OpTeX/ page}` outputs to the text \ulink[http://petr.olsak.net/optex]{\OpTeX/ page}. -The characters \code{\%}, `\`, `#`, `{`, and `}` must by escaped in +The characters \code{\%}, `\`, `#`, `{`, and `}` must be escaped in the <url> parameter. The PDF format provides {\em outlines} which are notes placed in the special frame of @@ -1862,7 +1870,6 @@ put it as the first command in your document: ~magscale'[factor] % resize typesetting, line/page breaking unchanged ~margins'/pg format (left, right, top, bottom)unit % margins setting - ~report' ~letter' ~slides' % style declaration macros \endtt @@ -1959,11 +1966,9 @@ control sequences with the same meaning: in prefixed and unprefixed form. For example `\hbox` is equal to `\_hbox`. Internal macros of \OpTeX/ have and use only prefixed form. User should use unprefixed forms, but prefixed forms are accessible too because the `_` is -set as a letter category code globally (in macro files and users document too). User +set as a letter category code globally (in macro files and users document too). Users should re-define unprefixed forms of control sequences without worries that -something internal will be broken (only the sequence `\par` cannot be -re-defined without change of internal \TeX/ behavior because it is -hard-coded in \TeX/, unfortunately). +something internal will be broken. \new The Latin Modern 8bit fonts instead Computer Modern 7bit fonts are |