diff options
author | Norbert Preining <norbert@preining.info> | 2021-04-27 03:00:54 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-04-27 03:00:54 +0000 |
commit | 95b070aee1a6351879af117f723c84d50b48338d (patch) | |
tree | 214e27cd933a5d3216ef0d0db495cbca43415e3c /macros/optex/base | |
parent | 03117c94362b2fed2fd4aabe50f3106fbf1e0a70 (diff) |
CTAN sync 202104270300
Diffstat (limited to 'macros/optex/base')
51 files changed, 608 insertions, 301 deletions
diff --git a/macros/optex/base/bib-iso690.opm b/macros/optex/base/bib-iso690.opm index c58709ce83..696084d8bb 100644 --- a/macros/optex/base/bib-iso690.opm +++ b/macros/optex/base/bib-iso690.opm @@ -1,6 +1,6 @@ % This is part of the OpTeX project, see http://petr.olsak.net/optex -% bibliography style (iso690), version <2020-03-10>, loaded on demand by \usebib +\_codedecl \_undefined {BIB style (iso690) <2021-04-07>} % loaded on demand by \usebib \_ifx\_optexbibstyle\_undefined \_errmessage {This file can be read by: \_string\usebib/? (iso690) bibfiles command only} @@ -33,8 +33,6 @@ \_toks1=\_ea{\_biboptionsi}% \_edef\_biboptionsi{\_space \_the\_toks1 \_space \_the\_biboptions \_space}% } -\_newtoks\_biboptions -\_public \biboptions ; \_doc ----------------------------- Formating of Author/Editor lists. @@ -399,12 +397,12 @@ If `aumin` is unused then `aumax` authors are printed in this case. 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` tokens list. For example: +your document by setting the \^`\biboptions` tokens list. For example: \begtt \biboptions={aumax:7 aumin:1} % if there are 8 or more authors then only the first author is printed. -\entdd +\endtt Examples: \begtt @@ -904,3 +902,8 @@ nowarn ... no mandatory fields \endtt Other options in the option field are silently ignored. + +\_endinput + +2021-04-07 ... \biboptions toks declaration moved, bug fixed. +2020-03-10 ... released diff --git a/macros/optex/base/bib-simple.opm b/macros/optex/base/bib-simple.opm index dff747bd57..ad1fde28bc 100644 --- a/macros/optex/base/bib-simple.opm +++ b/macros/optex/base/bib-simple.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -% bibliography style (simple), version <2020-03-10>, loaded on demand by \usebib +\_codedecl \_undefined {BIB style (simple) <2020-03-10>} % loaded on demand by \usebib \_ifx\_optexbibstyle\_undefined \_errmessage {This file can be read by: \_string\usebib/? (simple) bibfiles command only} diff --git a/macros/optex/base/cite-bib.opm b/macros/optex/base/cite-bib.opm index 26a5b17bd4..56954a4ee0 100644 --- a/macros/optex/base/cite-bib.opm +++ b/macros/optex/base/cite-bib.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \cite {Cite, Biblioraphy <2020-03-09>} % loaded in format +\_codedecl \cite {Cite, Biblioraphy <2021-04-13>} % loaded in format \_doc ----------------------------- Registers used by `\cite`, `\bib` macros are declared here. @@ -14,6 +14,15 @@ \_public \bibnum \bibmark ; \_doc ----------------------------- + \`\_bibp` expands to \^`\bibpart``/`. + By default, \^`\bibpart` is empty, so internal links are in the form + `cite:/<number>`. If \^`\bibpart` is set to `<bibpart>`, then internal + links are `cite:<bibpart>/<number>`. + \_cod ----------------------------- + +\_def\_bibp{\_the\_bibpart/} % unique name for each bibliography list + + \_doc ----------------------------- \`\cite` `[<label>,<label>,...,<label>]` manages <labes> using `\_citeA` and prints `[<bib-marks>]` using `\_printsavedcites`. \nl @@ -35,7 +44,7 @@ \_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\_eciteB#1,#2;#3{\_if?#1\_relax #3\_else \_ilink[cite:\_bibp#1]{#3}\_fi\_egroup} \_def\_savedcites{} \_public \cite \nocite \rcite \ecite ; @@ -45,39 +54,42 @@ It depends on \`\nonumcitations` and on used bib-style. The mapping from <label> to <bib-mark> is done when `\bib` or `\usebib` is processed. These macros store the information to - \`\_Xbib``{<label>}{<number>}{<nonumber>}` where <number> and <nonumber> are + \`\_Xbib``{<bibpart>}{<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 appropriate + `\_bib:<bibpart>/<label>` and `\_bim:<bibpart>/<number>`. + First one includes <number> and second one includes <nonumber>. + The `\_lastbn:<bibpart>` macro includes last number of + bib-entry used in the document with given <bibpart>. + A designer can use it to set appropriate 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}} +\_def\_Xbib#1#2#3#4{\_sxdef{_bib:#1/#2}{\_bibnn{#3}&}% + \_if^#4^\_else\_sxdef{_bim:#1/#3}{#4}\_fi\_sxdef{_lastbn:#1}{#3}} \_doc ----------------------------- \`\_citeA` `<label>,` processes one label from the 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 + <label> to a global list `\_ctlst:<bibpart>/` which will be used by `\usebib` (it must know what <labels> are used in the document 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 + space and to avoid duplications of <label> in the `\_ctlst:<bibpart>/`, 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 + * `<label>` was not declared by \^`\_Xbib` before and it is first such a <label> in the + document: Then `\_bib:<bibpart>/<label>` is undefined and we save label using + \^`\_addcitelist`, write warning on the terminal and define + `\_bib:<bibpart>/<label>` as empty. + * `<label>` was not declared by \^`\_Xbib` before but it was used previously in the + document: Then `\_bib:<bibpart>/<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>}&`. This is true 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` before and it is first such <label> + used in the document: Then `\_bib:<bibpart>/<label>` includes \`\_bibnn``{<number>}&` and we + test this case by the command `\if &\_bibnn{<number>}&`. This is true when `\_bibnn{<number>}` + expands to empty. The <label> is saved by \^`\_addcitelist` and + `\_bib:<bibpart>/<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 @@ -86,28 +98,53 @@ \_def\_citeA #1#2,{\_if#1,\_else \_if *#1\_addcitelist{*}\_ea\_skiptorelax \_fi - \_ifcsname _bib:#1#2\_endcsname \_else + \_ifcsname _bib:\_bibp#1#2\_endcsname \_else \_addcitelist{#1#2}% - \_opwarning{\_noexpand\cite [#1#2] unknown. Try to TeX me again}\_openref + \_opwarning{{\_the\_bibpart} \_noexpand\cite [#1#2] unknown. Try to TeX me again}\_openref \_incr\_unresolvedrefs \_addto\_savedcites{?,}\_def\_sortcitesA{}\_lastcitenum=0 - \_ea\_gdef \_csname _bib:#1#2\_endcsname {}% + \_ea\_gdef \_csname _bib:\_bibp#1#2\_endcsname {}% \_ea\_skiptorelax \_fi - \_ea\_ifx \_csname _bib:#1#2\_endcsname \_empty + \_ea\_ifx \_csname _bib:\_bibp#1#2\_endcsname \_empty \_addto\_savedcites{?,}\_def\_sortcitesA{}\_lastcitenum=0 \_ea\_skiptorelax \_fi \_def\_bibnn##1{}% - \_if &\_csname _bib:#1#2\_endcsname + \_if &\_csname _bib:\_bibp#1#2\_endcsname \_def\_bibnn##1##2{##1}% \_addcitelist{#1#2}% - \_sxdef{_bib:#1#2}{\_csname _bib:#1#2\_endcsname}% + \_sxdef{_bib:\_bibp#1#2}{\_csname _bib:\_bibp#1#2\_endcsname}% \_fi - \_edef\_savedcites{\_savedcites \_csname _bib:#1#2\_endcsname,}% + \_edef\_savedcites{\_savedcites \_csname _bib:\_bibp#1#2\_endcsname,}% \_relax \_ea\_citeA\_fi } -\_def\_addcitelist#1{\_global\_addto\_citelist{\_citeI[#1]}} -\_def\_citelist{} +\_let\_bibnn=\_relax + + \_doc ---------------------------- + Because we implement possibility of more independent bibliography lists + distinguished by <bibpart>, the \`\_addcitelist``{<label>}` macro + must add the <label> to given `\_ctlst:<bibpart>/`.\nl + When `\_addcitelist` is processed before \^`\usebib`, + then \`\_citeI``[<label>]` is added. \^`\usebib` will use this list for selecting + right records from `.bib` file. Then \^`\usebib` sets + `\_ctlst:<bibpart>/` to `\_write`.\nl + If `\_addcitelist` is processed after \^`\usebib`, then + \`\_Xcite``{<bibpart>/}{<label>}` is saved to the `.ref` + file. The `\_Xcite` creates `\_ctlstB:<bibpart>/` as a list of saved + `\_citeI[<label>]`. Finally, \^`\usebib` concats boths lists `\_ctlst:<bibpart>/` + and `\_ctlstB:<bibpart>/` in the second \TeX/ run. + \_cod ---------------------------- + +\_def\_addcitelist#1{% + \_unless \_ifcsname _ctlst:\_bibp\_endcsname \_sxdef{_ctlst:\_bibp}{}\_fi + \_ea \_ifx \_csname _ctlst:\_bibp\_endcsname \_write + \_openref \_immediate\_wref\_Xcite{{\_bibp}{#1}}% + \_else \_global \_ea\_addto \_csname _ctlst:\_bibp\_endcsname {\_citeI[#1]}\_fi +} +\_def\_Xcite#1#2{% + \_unless \_ifcsname _ctlstB:#1\_endcsname \_sxdef{_ctlstB:#1}{}\_fi + \_global \_ea\_addto \_csname _ctlstB:#1\_endcsname {\_citeI[#2]}% +} \_doc ----------------------------- The `<bib-marks>` (in numeric or text form) are saved in \^`\_savedcites` @@ -167,38 +204,47 @@ } \_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\_printcite#1{\_citesep + \_ilink[cite:\_bibp#1]{\_citelinkA{#1}}\_def\_citesep{,\_hskip.2em\_relax}} +\_def\_printdashcite#1{\_ifmmode-\_else\_hbox{--}\_fi\_ilink[cite:\_bibp#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 bib-style}\_fi}% + \_def\_citelinkA##1{\_trycs{_bim:\_bibp##1} + {##1\_opwarning{\_noexpand\nonumcitations + empty bibmark. Maybe bad bib-style}}}% } \_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. + The \`\bib` `[<label>]` or `\bib [<label>] ={<bib-mark>}` prints one bib-entry + without reading any database. The bib-entry 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>`. + saves \^`\_Xbib``{<bibpart>}{<label>}{<number>}{<nonumber>}` into `.ref` file + immediately using \`\_wbib``{<label>}{<number>}{<nonumber>}`. + This is the core of creation of mapping from `<labels>` to `<number>` and + `<nonumber>`.\nl + \`\_bibA` and \`\_bibB` implement the scanner of the optional argument + with the \^`\bibmark`.\nl + \`\_bibgl` is `\relax` by default but \^`\slides` do `\let\_bibgl=\_global`.\nl + \`\_dbib``{<label>}` creates destination for hyperlinks. \_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}% - \_printlabel{#1}% + \_bibgl\_advance\_bibnum by1 + \_noindent \_def\_tmpb{#1}\_dbib{#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\_dbib#1{\_dest[cite:\_bibp\_the\_bibnum]\_printlabel{#1}} +\_def\_wbib#1#2#3{% + \_ifx\_wref\_wrefrelax\_else \_immediate\_wref\_Xbib{{\_the\_bibpart}{#1}{#2}{#3}}\_fi + \_unless \_ifcsname bib:\_bibp#1\_endcsname \_Xbib{\_the\_bibpart}{#1}{#2}{#3}\_fi +} +\_let\_bibgl=\_relax \_public \bib ; @@ -245,22 +291,6 @@ \_def\_nobibwarning[#1]{\_global\_addto\_nobibwarnlist{#1,}} \_public \nobibwarning ; - \_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 @@ -269,3 +299,7 @@ files `bib-<style>.opm`. See end of the `bib-iso690.opm` file for large documentation about `.bib` files structure and about the usage of `iso690` bib-style. +History: +2021-04-13 ... \bibpart implemented +2021-04-13 ... \_bibgl introduced (used in \slides) +2020-03-09 ... released diff --git a/macros/optex/base/f-adventor.opm b/macros/optex/base/f-adventor.opm index df22be1130..e6b5ebabbd 100644 --- a/macros/optex/base/f-adventor.opm +++ b/macros/optex/base/f-adventor.opm @@ -11,7 +11,7 @@ Modifier:^^J }} \_moddef \resetmod {\_fsetV caps={} \_fvars regular bold italic bolditalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-antt.opm b/macros/optex/base/f-antt.opm index 39d3d011ea..bd11e01138 100644 --- a/macros/optex/base/f-antt.opm +++ b/macros/optex/base/f-antt.opm @@ -19,7 +19,7 @@ Modifiers:^^J \_onlyif sfamy={}: {\_fvars Regular Bold Italic BoldItalic }} \_moddef \medium {\_fsetV sfamy=Med \_fvars Regular . Italic . } \_moddef \light {\_fsetV sfamy=Light \_fvars Regular . Italic . } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-baskerville.opm b/macros/optex/base/f-baskerville.opm index 4e6027d703..a0f5e3e99d 100644 --- a/macros/optex/base/f-baskerville.opm +++ b/macros/optex/base/f-baskerville.opm @@ -11,7 +11,7 @@ Modifier:^^J }} \_moddef \resetmod {\_fsetV caps={} \_fvars Regular Bold Italic BoldItalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-bonum.opm b/macros/optex/base/f-bonum.opm index a285021b2e..5a3518dfe0 100644 --- a/macros/optex/base/f-bonum.opm +++ b/macros/optex/base/f-bonum.opm @@ -11,7 +11,7 @@ Modifier:^^J }} \_moddef \resetmod {\_fsetV caps={} \_fvars regular bold italic bolditalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-cursor.opm b/macros/optex/base/f-cursor.opm index 80b2a29457..13e52758bd 100644 --- a/macros/optex/base/f-cursor.opm +++ b/macros/optex/base/f-cursor.opm @@ -11,7 +11,7 @@ Modifier:^^J }} \_moddef \resetmod {\_fsetV caps={} \_fvars regular bold italic bolditalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-ebgaramond.opm b/macros/optex/base/f-ebgaramond.opm index 63502c9b08..c83ffb413f 100644 --- a/macros/optex/base/f-ebgaramond.opm +++ b/macros/optex/base/f-ebgaramond.opm @@ -18,7 +18,7 @@ Variant:^^J \_moddef \resetmod {\_fsetV caps={},swa={} \_fvars Regular Bold Italic BoldItalic } \_moddef \medium {\_fvars Medium ExtraBold MediumItalic ExtraBoldItalic } \_moddef \semibold {\_fvars Regular SemiBold Italic SemiBoldItalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_moddef \nocaps {\_fsetV caps={} } \_moddef \swash {\_fsetV swa=+swsh; } \_moddef \noswash {\_fsetV swa={} } diff --git a/macros/optex/base/f-garamondl.opm b/macros/optex/base/f-garamondl.opm index d642aac98c..c01b79c131 100644 --- a/macros/optex/base/f-garamondl.opm +++ b/macros/optex/base/f-garamondl.opm @@ -13,7 +13,7 @@ Modifiers:^^J }} \_moddef \resetmod {\_fsetV caps={},swa={} \_fvars Regular Bold Italic Bolditalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum;-liga; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum;-liga; } \_moddef \nocaps {\_fsetV caps={} } \_moddef \swash {\_fsetV swa=+swsh; } \_moddef \noswash {\_fsetV swa={} } diff --git a/macros/optex/base/f-gfsbodoni.opm b/macros/optex/base/f-gfsbodoni.opm index d7d3494a9d..8399f9d4d6 100644 --- a/macros/optex/base/f-gfsbodoni.opm +++ b/macros/optex/base/f-gfsbodoni.opm @@ -11,7 +11,7 @@ Modifier:^^J }} \_moddef \resetmod {\_fsetV caps={} \_fvars {} Bold It BoldIt } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-heros.opm b/macros/optex/base/f-heros.opm index 767052cc45..2aec4b466a 100644 --- a/macros/optex/base/f-heros.opm +++ b/macros/optex/base/f-heros.opm @@ -12,7 +12,7 @@ Modifiers:^^J }} \_moddef \resetmod {\_fsetV caps={},cond={} \_fvars regular bold italic bolditalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_moddef \nocaps {\_fsetV caps={} } \_moddef \cond {\_fsetV cond=cn } \_moddef \nocond {\_fsetV cond={} } @@ -140,12 +140,12 @@ with obvious result `\def\_<word-a>V {<value-a>}\def\_<word-b>V {<value-b>}` etc \seccc Example 3 If both font modifiers `\caps`, `\cond` were applied in Heros -family, then `\def\_capsV{+smcp;+onum}` and `\def\_condV{cn}` were processed +family, then `\def\_capsV{+smcp;\_ffonum;}` and `\def\_condV{cn}` were processed by these font modifiers. If a user needs the `\bf` variant at 11\,pt now then the \begtt - \font {[texgyreheroscn-bold]:+smcp;+onum;+tlig;} at11pt + \font {[texgyreheroscn-bold]:+smcp;+onum;+pnum;+tlig;} at11pt \endtt % is processed. We assume that a font file `texgyreheroscn-bold.otf` is present diff --git a/macros/optex/base/f-kpfonts.opm b/macros/optex/base/f-kpfonts.opm index c030bea8e8..8b293ee49f 100644 --- a/macros/optex/base/f-kpfonts.opm +++ b/macros/optex/base/f-kpfonts.opm @@ -19,7 +19,7 @@ Modifiers:^^J \_moddef \sans {\_fsetV subfam=Sans \_RBIfvars } \_moddef \mono {\_fsetV subfam=Mono \_RBIfvars } \_moddef \light {\_fsetV subfam=Roman \_fvars Light Semibold LightItalic SemiboldItalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_moddef \nocaps {\_fsetV caps={} } \_moddef \swash {\_fsetV swa=+swsh; } \_moddef \noswash {\_fsetV swa={} } diff --git a/macros/optex/base/f-libertine-s.opm b/macros/optex/base/f-libertine-s.opm index 3cdc089312..751dd17622 100644 --- a/macros/optex/base/f-libertine-s.opm +++ b/macros/optex/base/f-libertine-s.opm @@ -19,7 +19,7 @@ Special variants:^^J \_moddef \resetmod {\_fsetV mainfam=Libertine,subfam={},caps={} \_fvars {} B I BI } \_moddef \sans {\_fsetV mainfam=Biolinum,subfam={} } \_moddef \mono {\_fsetV mainfam=Libertine,subfam={Mono } \_fvars {} . . . } -\_moddef \caps {\_fsetV caps=+smcp; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_moddef \nocaps {\_fsetV caps={} } \_famvardef \initials {\_fsetV mainfam=Libertine,subfam={Initials } \_fvars {} . . . \rm} diff --git a/macros/optex/base/f-libertine.opm b/macros/optex/base/f-libertine.opm index b25c2fc4f9..bd90bedf0f 100644 --- a/macros/optex/base/f-libertine.opm +++ b/macros/optex/base/f-libertine.opm @@ -21,7 +21,7 @@ Special variants:^^J \_moddef \sans {\_fsetV subfam=Biolinum \_fvars R RB RI RBO } \_moddef \mono {\_fsetV subfam=Libertine \_fvars M MB MO MBO } \_moddef \semibold {\_fsetV subfam=Libertine \_fvars R RZ RI RZI } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_moddef \nocaps {\_fsetV caps={} } \_famvardef \initials {\_fsetV subfam=Libertine \_fvars I . . . \rm} diff --git a/macros/optex/base/f-libertinus.opm b/macros/optex/base/f-libertinus.opm index 5f1329d286..a3b74cc6be 100644 --- a/macros/optex/base/f-libertinus.opm +++ b/macros/optex/base/f-libertinus.opm @@ -20,7 +20,7 @@ Special variants:^^J \_moddef \resetmod {\_fsetV subfam=Serif,caps={} \_fvars Regular Bold Italic BoldItalic } \_moddef \semibold {\_fsetV subfam=Serif \_fvars Regular Semibold Italic SemiboldItalic } \_moddef \sans {\_fsetV subfam=Sans \_fvars Regular Bold Italic . } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_moddef \nocaps {\_fsetV caps={} } \_famvardef \mono {\_fsetV subfam=Mono \_fvars Regular . . . \_rm} diff --git a/macros/optex/base/f-librecaslon.opm b/macros/optex/base/f-librecaslon.opm index 53f61834f1..459cc90d1f 100644 --- a/macros/optex/base/f-librecaslon.opm +++ b/macros/optex/base/f-librecaslon.opm @@ -12,7 +12,7 @@ Modifier:^^J \_moddef \resetmod {\_fsetV caps={},csl={CaslonText} \_fvars \_cslV-Regular \_cslV-Bold \_cslV-Italic Csln-Bolditalic } -\_moddef \onum {\_fsetV caps=+onum; } +\_moddef \onum {\_fsetV caps=\_ffonum; } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-lmfonts.opm b/macros/optex/base/f-lmfonts.opm index 13865890e2..3b1e0d0c40 100644 --- a/macros/optex/base/f-lmfonts.opm +++ b/macros/optex/base/f-lmfonts.opm @@ -21,7 +21,9 @@ Sub-modifiers (selects special variants of given subfamily):^^J \caps ...... caps & small caps (available only at limited shapes)^^J \slant ..... slanted (default in some subfamilies)^^J \nbold ..... normal bold (extended bold is default)^^J - \bolder .... extended bold^^J + \bolder .... extended bold^^J% +Note: Text fonts support optical sizes, but LatinModern-Math only for scripts.^^J + Use another CM-like family if optical sizes not wanted: \fontfam[NewCM]. }} \_def\_LMregfont #1 #2 #3{% diff --git a/macros/optex/base/f-merriweather.opm b/macros/optex/base/f-merriweather.opm index f2972aaafd..c4f977e46e 100644 --- a/macros/optex/base/f-merriweather.opm +++ b/macros/optex/base/f-merriweather.opm @@ -17,7 +17,7 @@ Extended variants:^^J }} \_moddef \resetmod {\_fsetV caps={},sans={} \_fvars Regular Bold Italic BoldItalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_moddef \nocaps {\_fsetV caps={} } \_moddef \sans {\_fsetV sans=Sans } \_moddef \serif {\_fsetV sans={} } diff --git a/macros/optex/base/f-newcm.opm b/macros/optex/base/f-newcm.opm new file mode 100644 index 0000000000..ba83b0d729 --- /dev/null +++ b/macros/optex/base/f-newcm.opm @@ -0,0 +1,37 @@ +%% This is part of the OpTeX project, see http://petr.olsak.net/optex + +\_famdecl [New Computer Modern] \NewCM {CM with Book variants, Cyrillic, Greek} + {\book \ttset \sans \caps} {\rm \bf \it \bi} {NewCMMath} + {[NewCM10-Regular]} + {\_def\_fontnamegen {[NewCM\_typfV-\_currV]:\_capsV\_fontfeatures}} + +\_wlog{\_detokenize{% +Modifiers:^^J + \book ...... slightly bolder \rm, \it^^J + \ttset ..... Typewriter variants^^J + \sans ...... Sans serif variants^^J + \caps ...... caps & small caps (not in Italic variants)^^J% +Note: use \book\normalmath if you want Math in book-style too. +}} + +\_moddef \resetmod {\_fsetV caps={},typf=10,book={} \_fvars Regular Bold {\_ncmI} {\_ncmBI} } +\_moddef \book {\_fsetV book=Book \_fvars Book Bold {\_ncmI} {\_ncmBI} + \_def\_unimathfont{NewCMMath-Book}} +\_moddef \ttset {\_fsetV typf=Mono10 } +\_moddef \sans {\_fsetV typf=Sans10 } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } + +\_def\_ncmtyprm{10} +\_def\_ncmtypsans{Sans10} +\_def\_ncmI {\_bookV \_ifx\_typfV\_ncmtypsans Oblique\_else Italic\_fi} +\_def\_ncmBI {Bold\_ifx\_typfV\_ncmtyprm Italic\_else Oblique\_fi} + +\_initfontfamily % new font family must be initialized + +\_loadmath {[NewCMMath-Regular]} + +\_endcode + +See the file `f-heros.opm` for information about principles of such +font-macro-files. + diff --git a/macros/optex/base/f-pagella.opm b/macros/optex/base/f-pagella.opm index a0e4eb8e30..135b242259 100644 --- a/macros/optex/base/f-pagella.opm +++ b/macros/optex/base/f-pagella.opm @@ -11,7 +11,7 @@ Modifier:^^J }} \_moddef \resetmod {\_fsetV caps={} \_fvars regular bold italic bolditalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-poltawski.opm b/macros/optex/base/f-poltawski.opm index ffc7e8474d..6ebf089a31 100644 --- a/macros/optex/base/f-poltawski.opm +++ b/macros/optex/base/f-poltawski.opm @@ -24,7 +24,7 @@ Modifiers:^^J \_moddef \expd {\_fsetV cond=semiexpd } \_moddef \cond {\_fsetV cond=semicond } \_moddef \ccond {\_fsetV cond=cond } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_moddef \nocaps {\_fsetV caps={} } \_moddef \osize {\_def\_fontnamegen{[antpolt\_liV\_optname{x}-\_currV]:\_capsV\_fontfeatures}% \_regoptsizes x ? expd <7 semiexpd <9 {} <11.1 semicond <15 cond <*} diff --git a/macros/optex/base/f-roboto.opm b/macros/optex/base/f-roboto.opm index 51dfffff25..2b810fcd53 100644 --- a/macros/optex/base/f-roboto.opm +++ b/macros/optex/base/f-roboto.opm @@ -40,7 +40,7 @@ Extended variants:^^J \_onlyif sub=Slab: {\_fvars Regular Bold . . }} \_moddef \bolder {\_onlyif sub={}: {\_fsetV w=b \_fvars Medium Black MediumItalic BlackItalic }} -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_moddef \nocaps {\_fsetV caps={} } \_famvardef \tf {\_thinM \_rm} diff --git a/macros/optex/base/f-schola.opm b/macros/optex/base/f-schola.opm index 067a6d0ce2..e0900b4de0 100644 --- a/macros/optex/base/f-schola.opm +++ b/macros/optex/base/f-schola.opm @@ -11,7 +11,7 @@ Modifier:^^J }} \_moddef \resetmod {\_fsetV caps={} \_fvars regular bold italic bolditalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-sourcepro.opm b/macros/optex/base/f-sourcepro.opm index a8e847104e..a8b1137c11 100644 --- a/macros/optex/base/f-sourcepro.opm +++ b/macros/optex/base/f-sourcepro.opm @@ -25,7 +25,7 @@ Modifiers:^^J \_moddef \elight {\_fvars ExtraLight Regular ExtraLightIt RegularIt } \_moddef \bolder {\_fvars Semibold Black SemiboldIt BlackIt } \_moddef \medium {\_fsetV typf=Code \_fvars Medium Bold MediumIt BoldIt } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_moddef \nocaps {\_fsetV caps={} } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-technika.opm b/macros/optex/base/f-technika.opm index 77b894e53b..b29b29ed0c 100644 --- a/macros/optex/base/f-technika.opm +++ b/macros/optex/base/f-technika.opm @@ -1,7 +1,7 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex \_famdecl [Technika] \Technika {Fonts from visual style of CTU in Prague} - {\caps \light} {\rm \bf \it \bi \stencil} {} + {\caps \light \book} {\rm \bf \it \bi \stencil} {} {[Technika-Regular]} {\_def\_fontnamegen {[Technika\_stencilV-\_currV]:\_capsV\_fontfeatures}} @@ -17,7 +17,7 @@ Special variant:^^J \_moddef \resetmod {\_fsetV stencil={},caps={} \_fvars Regular Bold Italic BoldItalic } \_moddef \light {\_fsetV stencil={} \_fvars Light Regular LightItalic Italic } \_moddef \book {\_fsetV stencil={} \_fvars Book Bold BookItalic BoldItalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp\_ffonum; } \_famvardef \stencil {\_fsetV stencil=Stencil \_fvars Bold . Bold . \rm} diff --git a/macros/optex/base/f-termes.opm b/macros/optex/base/f-termes.opm index 8cd6ee6d8a..877aa1ded0 100644 --- a/macros/optex/base/f-termes.opm +++ b/macros/optex/base/f-termes.opm @@ -11,7 +11,7 @@ Modifier:^^J }} \_moddef \resetmod {\_fsetV caps={} \_fvars regular bold italic bolditalic } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-xcharter.opm b/macros/optex/base/f-xcharter.opm index 9ad886d47f..b776582a1c 100644 --- a/macros/optex/base/f-xcharter.opm +++ b/macros/optex/base/f-xcharter.opm @@ -13,7 +13,7 @@ Modifiers:^^J \_moddef \resetmod {\_fsetV caps={} \_fvars Roman Bold Italic BoldItalic } \_moddef \slant {\_fvars Roman Bold Slanted BoldSlanted } -\_moddef \caps {\_fsetV caps=+smcp;+onum; } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } \_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/fams-ini.opm b/macros/optex/base/fams-ini.opm index 3c8ded975e..1d4d9f5c59 100644 --- a/macros/optex/base/fams-ini.opm +++ b/macros/optex/base/fams-ini.opm @@ -49,6 +49,13 @@ \_famtext {Other fonts:} +\_famfrom{Antonis Tsolomitis} +\_faminfo [New Computer Modern] {CM with Book variants, Cyrillic, Greek} {f-newcm} + { -: {\rm\bf\it\bi} \book: {\rm\it} \ttset: {\rm\bf\it\bi} \book\ttset: {\rm\it} + \sans: {\rm\bf\it\bi} \book\sans: {\rm\it} + \caps: {\rm\bf} \book\caps: {\rm} } +\_famalias [NewCM] \_famalias [NewCMfonts] + \_famfrom {Philipp H. Poll} \_faminfo [Linux Libertine] {Free fonts typically installed on systems} {f-libertine} { -: {\rm\bf\it\bi} \semibold: {\bf\bi} @@ -153,7 +160,7 @@ \_endcode Once you have prepared a font family file with the name `f-<famname>.opm` and -\TeX/can see it in your filesystem then you can type \^`\fontfam``[<famname>]` and +\TeX/ can see it in your filesystem then you can type \^`\fontfam``[<famname>]` and the file is read, so the information about the font family is loaded. The name `<famname>` must be lowercase and without spaces in the file name `f-<famname>.opm`. On the other hand, the `\fontfam` command is more tolerant: @@ -178,7 +185,7 @@ declaration of Adobe's Times family in `fams-local.opm`. When a user writes `\fontfam[Times]` then the original Times (not Termes) is used. The `fams-ini.opm` and `fams-local.opm` files use the macros -`\_famifo`, `\_famalias` and `\_famtext`. See the example from +\~`\_faminfo`, \~`\_famalias` and \~`\_famtext`. See the example from `fams-ini.tex`: {\everytt={\typosize[8/10]\_let\_printverbline=\_printcodeline \medskip} diff --git a/macros/optex/base/fnotes.opm b/macros/optex/base/fnotes.opm index 612b32a17d..1445c57d4c 100644 --- a/macros/optex/base/fnotes.opm +++ b/macros/optex/base/fnotes.opm @@ -50,9 +50,9 @@ \_def \_printfnotemarkB {\_printfnotemark} % footnote marks used in front of footnotes \_def \_fnotelinks#1#2{% <inText color> <inFootnote color> - \_def\_printfnotemarkA{\_link[fnt:\_the\_gfnotenum]{\_localcolor#1}{\_printfnotemark}% + \_def\_printfnotemarkA{\_link[fnt:\_the\_gfnotenum]{#1}{\_printfnotemark}% \_dest[fnf:\_the\_gfnotenum]}% - \_def\_printfnotemarkB{\_link[fnf:\_the\_gfnotenum]{\_localcolor#2}{\_printfnotemark}% + \_def\_printfnotemarkB{\_link[fnf:\_the\_gfnotenum]{#2}{\_printfnotemark}% \_dest[fnt:\_the\_gfnotenum]}% } \public \fnotelinks ; diff --git a/macros/optex/base/fonts-resize.opm b/macros/optex/base/fonts-resize.opm index ac0064df10..7d1ce6cbed 100644 --- a/macros/optex/base/fonts-resize.opm +++ b/macros/optex/base/fonts-resize.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \setfontsize {Font resizing macros <2020-04-17>} % preloaded in format +\_codedecl \setfontsize {Font resizing macros <2021-04-17>} % preloaded in format \_doc ----------------------------- The \`\setfontsize` `{<sizespec>}` saves the `<sizespec>` to the \`\_sizespec` macro. @@ -34,27 +34,36 @@ \_doc ----------------------------- \`\_resizefont` `{<variant-name>}\<font switch>`, - for example `\resizefont{bf}\_tenbf` resizes the font given by the - variant. The variant `XX` have its font switch `\_tenXX`. - The \`\_doresizefont``\fontswitch` is used. It works in - TFM mode (\`\_doresizetfmfont`) or OTF mode (\^`\_doresizeunifont`). - In both modes, it does - \begtt \catcode`\<=13 - \_font \_tenXX = <fontname> \_sizespec + resizes the font given by the variant. + The <variant-name> is `rm` or `bf` or `it` or `bi`. + The new <font-switch> is declared (roughly speaking) by: + \begtt \catcode`<=13 + \_font <font switch> = <fontname of>\_ten<variant-name> \_sizepec + \endtt + If the \^`\_fontselector` is defined then it has priority before <font-switch> + and the font is loaded by: + \begtt \catcode`<=13 + \_ea\_font \_fontselector = <fontname of>\_ten<variant-name> \_sizepec \endtt - The `<fontname>` is generated by the `\fontname` \TeX/ primitive where - \`\_rfontskipat` removes the `at<dimen>` part of the `\_fontname` output. - The `<fontname>` is generated differently in OTF mode, see + The font is loaded by \`\_doresizefont``<font switch>`. This macro has + meaning \`\_doresizetfmfont` in TFM mode and it switches to + \^`\_doresizeunifont` when \^`\initunifonts` is used.\nl + The `<fontname of>` is generated by the `\fontname` \TeX/ primitive where + \`\_rfontskipat` removes the `at<dimen>` part of the `\fontname` output. + The `<fontname of>` is generated differently in OTF mode, see \^`\_doresizeunifont` macro.\nl - The \`\_whatresize` is defined as `<variant-name>`. + The \`\_whatresize` is defined as `<variant-name>`.\nl + The \^`\_fontloaded``<font switch>` is a macro which can be used for + post-processing when a font is loaded. \_cod ----------------------------- \_def\_resizefont#1#2{% - \_edef\_whatresize{#1}% - \_ifx \_fontselector \_undefined \_doresizefont#2% - \_else \_ea \_doresizefont \_fontselector \_fi - \_lastmagsize=\_zo - \_slet{_tryload#1}{_relax}% + \_edef\_whatresize{#1}% + \_ifx \_fontselector \_undefined + \_doresizefont#2\_relax \_ea\_fontloaded \_csname _ten#1\_endcsname + \_else \_ea\_doresizefont \_fontselector \_ea\_fontloaded \_fontselector \_fi + \_lastmagsize=\_zo + \_slet{_tryload#1}{_relax}% } \_def\_doresizetfmfont#1{\_logfont{#1}% \_ea\_font\_ea#1\_ea\_rfontskipat @@ -68,6 +77,24 @@ \_def\_rfskipatN #1 #2\_relax{\_whichtfm{#1}} \_doc ----------------------------- + If a font is loaded by \^`\_resizefont` or \^`\resizethefont` then the + \`\_fontloaded``<font switch>` is called immediately after it. If the font + is loaded first then its `\skewchar` is equal to $-1$. We run + \`\_newfontloaded``<font switch>` and set `\skewchar=-2` in this case. + A user can define a `\_newfontloaded` macro. We are sure that + `\_newfontloaded` macro is called only once for each instance of the font + given by its name, OTF features and size specification. The `\skewchar` value is + globally saved to the font (like `\fontdimen`). If it is used in math + typesetting then it is set to a positive value.\nl + The `\_newfontloaded` should be defined for micro-typographic configuration of + fonts, for example. See + \ulink[http://petr.olsak.net/optex/optex-tricks.html\#fontexpand]{OpTeX/ trick 0058}. + \_cod ----------------------------- + +\_def\_fontloaded #1{\_ifnum\_skewchar#1=-1 \_skewchar#1=-2 \_newfontloaded#1\_fi} +\_def\_newfontloaded #1{} + + \_doc ----------------------------- \`\fontdef` `<font switch>{<modifiers><variant selector>}` opens group, runs `<modifiers><variant selector>` (i.e.\ it runs `#2` parameter). The font switch `#1` saved in the \`\_fontselector` macro is re-declared @@ -110,7 +137,7 @@ \_def \_newcurrfontsize #1{% \newcurrfontsize{at25pt} \_edef\_tmp{\_ea\_csstring \_the\_font}% \_ea \_fontlet \_csname \_tmp\_ea\_endcsname \_the\_font \_space #1\_relax - \_csname \_tmp\_endcsname + \_ea\_fontloaded \_csname \_tmp \_ea\_endcsname \_csname \_tmp\_endcsname } \_protected\_def \_resizethefont{\_newcurrfontsize\_sizespec} @@ -127,7 +154,7 @@ \_loadf{it}\_tenit \_loadf{bi}\_tenbi } \_def\_loadf#1#2{\_sdef{_tryload#1}{\_ifmmode \_else \_resizefont{#1}#2\_fi}} -\_def\_tryloadtt{\_resizefont{tt}\_tentt} +\_def\_tryloadtt{\_resizefont{tt}\_tentt} % only in TFM mode \_let\_tryloadrm=\_relax \_let\_tryloadbf=\_relax @@ -350,5 +377,6 @@ and OTF Latin Modern fonts in the `f-lmfonts.opm` file. \_endinput +2021-04-17 \_fontloaded, \_newfontloaded introduced 2020-04-17 \resizethefont introduced 2020-03-17 released diff --git a/macros/optex/base/fonts-select.opm b/macros/optex/base/fonts-select.opm index 740b311a67..eab114fcc4 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-02-25>} % preloaded in format +\_codedecl \fontfam {Fonts selection system <2021-04-22>} % preloaded in format \_doc ----------------------------- \`\initunifonts` macro extends \LuaTeX's font capabalities, @@ -114,7 +114,10 @@ `<value-b>` or ... or `<value-z>`. \nl \`\_prepcommalist` `ab,{},cd,\_end,` expands to `ab,,cd,` (auxiliary macro - used in `\_onlyif`). + used in `\_onlyif`).\nl + \`\_ffonum` is a shortcut for oldstyle digits font features used in + font family files. You can do `\let\_ffonum=\ignoreit` if you don't want + to set old digits together with `\caps`. \_cod ----------------------------- \_def\_fvars #1 #2 #3 #4 {% @@ -137,6 +140,7 @@ \_iftrue #3\_fi } \_def\_prepcommalist#1,{\_ifx\_end#1\_empty\_else #1,\_ea\_prepcommalist\_fi} +\_def\_ffonum {+onum;+pnum} \_doc ----------------------------- The \`\moddef` `\<modifier> {<data>}` simply speaking does @@ -359,7 +363,7 @@ \_doc ----------------------------- The \`\setfontcolor` and \`\setletterspace` are macros based on the special font features provided by \LuaTeX/ (and by \XeTeX/ too but it is not - our business). The \`\setwordspace` recalulates the `\fontdimen2,3,4` + our business). The \`\setwordspace` recalculates the `\fontdimen2,3,4` of the font using the \`\setwsp` macro which is used by the \^`\_doresizeunifont` macro. It activates a dummy font feature `+Ws` too in order the font is reloded by the `\font` primitive (with independent @@ -381,12 +385,14 @@ } \_def \_setwordspace #1{% \_if^#1^\_def\_setwsp##1{}\_removefeature{+Ws}% - \_else \_def\_setwsp{\_setwspA{#1}}\_setff{+Ws}\_fi + \_else \_def\_setwsp{\_setwspA#1/}\_setff{+Ws}\_fi \_reloading } \_def\_setwsp #1{} -\_def\_setwspA #1#2{\_fontdimen2#2=#1\_fontdimen2#2% - \_fontdimen3#2=#1\_fontdimen3#2\_fontdimen4#2=#1\_fontdimen4#2} +\_def\_setwspA #1{\_ifx/#1\_ea\_setwspB \_else\_afterfi{\_setwspC#1}\_fi} +\_def\_setwspB #1/#2/#3/#4{\_fontdimen2#4=#1\_fontdimen2#4% + \_fontdimen3#4=#2\_fontdimen3#4\_fontdimen4#4=#3\_fontdimen4#4} +\_def\_setwspC #1/{\_setwspB #1/#1/#1/} \_def\_calculatefontcolor#1{\_trycs{_fc:#1}{#1}} % you can define more smart macro ... \_sdef{_fc:red}{FF0000FF} \_sdef{_fc:green}{00FF00FF} \_sdef{_fc:blue}{0000FFFF} @@ -774,19 +780,23 @@ empty parameter `<number>` means no letter spacing which is the default. \^`\setwordspace` `{<scaling>}` scales the default interword space (defined in the font) and its stretching and shrinking parameters by given `<scaling>` factor. For example `\setwordspace{2.5}` multiplies interword space by 2.5. +\^`\setwordspace` can use different multiplication factors if its parameter is in the +format `{/<default>/<stretching>/<shrinking>}`. For example, +`\setwordspace{/1/2.5/1}` enlarges only stretching 2.5~times. -If you need another font transformations, you can use `\setff` -with following font features provided by Lua\TeX/: +You can use `\setff` with other font features provided by Lua\TeX/ and `luaotfload` package +(see documentation of `loaotfload` package for more information): \begtt -\setff{embolden=1.5}\rm % font is bolder because outline has nonzero width -\setff{slant=0.2}\rm % font is slanted by a linear transformation -\setff{extend=1.2}\rm % font is extended by a linear transformation. -\setff{colr=yes}\rm % if the font includes colored characters, use colors -\setff{upper}\rm % to uppercase (lower=lowecase) conversion at font level +\setff{embolden=1.5}\rm % font is bolder because outline has nonzero width +\setff{slant=0.2}\rm % font is slanted by a linear transformation +\setff{extend=1.2}\rm % font is extended by a linear transformation. +\setff{colr=yes}\rm % if the font includes colored characters, use colors +\setff{upper}\rm % to uppercase (lower=lowecase) conversion at font level +\setff{fallback=name}\rm % use fonts from a list given by name if missing chars \endtt -Use font transformations mentioned above and \^`\setletterspace`, +Use font transformations `embolden`, `slant`, `extend` and \^`\setletterspace`, \^`\setwordspace` with care. The best setting of these values is the default setting in every font, of course. If you really need to set a different letter spacing then it is strongly recommended to add `\setff{-liga}` @@ -838,6 +848,8 @@ Luaotfload documentation for more information. \endinput +2021-04-22 \_ffonum introduced +2021-04-19 \setwordspace: parameter format {/A/B/C} implemented. 2021-02-25 \_ttunifont introduced 2021-01-27 lua hack (print function) removed because luaotfload 3.17 removes bug. 2020-12-12 \_modlist added, doc improved diff --git a/macros/optex/base/graphics.opm b/macros/optex/base/graphics.opm index afff1c1284..1adb444b4e 100644 --- a/macros/optex/base/graphics.opm +++ b/macros/optex/base/graphics.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \inspic {Graphics <2020-04-12>} % preloaded in format +\_codedecl \inspic {Graphics <2021-03-19>} % preloaded in format \_doc ----------------------------- \`\inspic` accepts old syntax `\inspic <filename><space>` @@ -40,13 +40,14 @@ \_def\_inkinspicA #1 {\_inkinspicB {#1}} \_def\_inkinspicB #1{% \_ifdim\_picwidth=0pt \_setbox0=\_hbox{\_inspic{#1}}\_picwidth=\_wd0 \_fi + \_tmptoks={#1}% \_the\_inkdefs \_opinput {\_the\_picdir #1_tex}% file with labels \_egroup} \_newtoks\_inkdefs \_inkdefs={% \_def\makeatletter#1\makeatother{}% - \_def\includegraphics[#1]#2{\_inkscanpage#1,page=,\_end \_inspic{#2}\_hss}% + \_def\includegraphics[#1]#2{\_inkscanpage#1,page=,\_end \_inspic{\_the\_tmptoks}\_hss}% \_def\_inkscanpage#1page=#2,#3\_end{\_ifx,#2,\_else\_def\_picparams{page#2}\_fi}% \_def\put(#1,#2)#3{\_nointerlineskip\_vbox to\_zo{\_vss\_hbox to\_zo{\_kern#1\_picwidth \_pdfsave\_hbox to\_zo{#3}\_pdfrestore\_hss}\_kern#2\_picwidth}}% @@ -440,6 +441,7 @@ the \^`\transformbox{<transformation>}{\copy\mypic}`. \_endinput +2021-03-19: \inkinspic: pictures in subdirectories, bug fixed 2020-12-21: \puttext: \box0 in goup, bugfix 2020-04-12: \_public \clipinoval \clipincircle ; added, bug fixed diff --git a/macros/optex/base/hyperlinks.opm b/macros/optex/base/hyperlinks.opm index 5fc8a32233..95fae3846b 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-01-27>} % preloaded in format +\_codedecl \ulink {Hyperlinks <2021-04-17>} % preloaded in format \_doc ---------------------------- \`\dest``[<type>:<spec>]` creates a destination of internal links. The @@ -28,20 +28,30 @@ \`\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` - command is not used, then `\link` only prints `<text>` else it is set to + command is not used, then `\link` only prints `<text>` else its meaning is set to `\_linkactive`. The \`\_linkactive` is implemented by `\_pdfstartlink...\_pdfendlink` - primitives. + primitives. The `<color>` is the color of the link text generated by + the `\_linkactive` macro. + The `<color>` parameter can be overwritten by definition of + `\_<type>linkcolor`. For example `\def\_toclinkcolor{\Red}` means that + links from table of contents are in red. This is similar concept as + `\_def\_tocborder`. \nl \`\ilink``[<type>:<spec>]{<text>}` is equivalent to `\_link` but - the `<color>` is used from \^`\hyperlinks` declaration. + the `<color>` is used from \^`\hyperlinks` declaration + (or it is overwriten by `\def\_<type>linkcolor`). + \nl + \`\_linkdimens` are default dimensions of the link area. \_cod ---------------------------- -\_protected\_def\_linkactive[#1:#2]#3#4{\_leavevmode\_pdfstartlink height.9em depth.3em - \_pdfborder{#1} goto name{#1:#2}\_relax {#3#4}\_pdfendlink +\_protected\_def\_linkactive[#1:#2]#3#4{\_leavevmode\_pdfstartlink \_linkdimens + attr{\_pdfborder{#1}} goto name{#1:#2}\_relax + {\_localcolor\_trycs{_#1linkcolor}{#3}#4}\_pdfendlink } \_protected\_def\_link[#1]#2#3{\_leavevmode{#3}} -\_protected\_def\_ilink[#1]#2{\_leavevmode{#2}} +\_def\_ilink[#1]#2{\_link[#1]{}{#2}} +\_def\_linkdimens{height.9em depth.3em} \_public \ilink \link ; \_doc ---------------------------- @@ -53,19 +63,18 @@ \_cod ---------------------------- \_protected\_def\_urlactive[#1:#2]#3#4{\_leavevmode{\_escapechar=-1 - \_pdfstartlink height.9em depth.3em \_pdfborder{#1}% + \_pdfstartlink \_linkdimens attr{\_pdfborder{#1}}% user{/Subtype/Link/A <</Type/Action/S/URI/URI(\_detokenize{#2})>>}\_relax - {#3#4}\_pdfendlink}% + {\_localcolor\_trycs{_#1linkcolor}{#3}#4}\_pdfendlink}% } \_def\_ulink[#1]#2{\_leavevmode{#2}} -\_def\_urlcolor{} \_public \ulink ; \_doc ---------------------------- - The `\_pdfstartlink` primitive uses `\_pdfborder{<type>}` in its parameter + The `\_pdfstartlink` primitive uses `attr{\_pdfborder{<type>}}` in its parameter (see \^`\_linkactive` or \^`\_urlactive` macros). The \`\_pdfborder``{<type>}` - expands to `attr{/C[? ? ?] /Border[0 0 .6]}` if the - `\_<type>border` (i.e.\ \`\_refborder`, \`\_citeborder`, \`\_tocborder`, + macro expands to `/C[? ? ?] /Border[0 0 .6]` if the + `\_<type>border` macro (i.e.\ \`\_refborder`, \`\_citeborder`, \`\_tocborder`, \`\_pgborder`, \`\_urlborder`, \`\_fntborder` or \`\_fnfborder`) is defined. Users can define it in order to create colored frames around active links. For example @@ -74,8 +83,7 @@ \_cod ---------------------------- \_def\_pdfborder#1{\_ifcsname _#1border\_endcsname - attr{/C[\_csname _#1border\_endcsname] /Border[0 0 .6]}% - \_else attr{/Border[0 0 0]}\_fi + /C [\_csname _#1border\_endcsname] /Border [0 0 .6]\_else /Border [0 0 0]\_fi } \_doc ---------------------------- @@ -86,8 +94,8 @@ \_def\_hyperlinks#1#2{% \_let\_dest=\_destactive \_let\_link=\_linkactive - \_def\_ilink[##1]##2{\_link[##1]{\_localcolor#1}{##2}}% - \_def\_ulink[##1]##2{\_urlactive[url:##1]{\_localcolor#2}{##2}}% + \_def\_ilink[##1]##2{\_link[##1]{#1}{##2}}% + \_def\_ulink[##1]##2{\_urlactive[url:##1]{#2}{##2}}% \_public \dest \ilink \ulink \link ;% } \_public \hyperlinks ; @@ -136,8 +144,8 @@ There are four types of internal links and one type of external link: 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]. +* `cite:<bibpart>/<bibnum>` -- the destination is created in bibliography reference, + see section \ref[bib]. * `url:<url>` -- used by `\url` or `\ulink`, see also the end of this section. \enditems @@ -152,6 +160,8 @@ of internal links are created at the same destination place: \_endinput +2021-04-17 attr{\_pdfborder{...}} instead expanding \_pdfborder to attr{...} +2021-04-02 The possibility of \def\_toclinkcolor introduced, \localcolor moved 2021-01-27 \public \link added to \hyperlinks, bug fixed. 2020-04-22 \| in \url: bug fixed -2020-03-15 introduced
\ No newline at end of file +2020-03-15 introduced diff --git a/macros/optex/base/hyphen-lan.opm b/macros/optex/base/hyphen-lan.opm index dad0b26657..7a6c790d1f 100644 --- a/macros/optex/base/hyphen-lan.opm +++ b/macros/optex/base/hyphen-lan.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \langlist {Initialization of hypenation patterns <2020-03-10>} % preloaded in format +\_codedecl \langlist {Initialization of hypenation patterns <2021-03-29>} % preloaded in format \_doc ----------------------------- The <iso-code> means a shortcut of language name (mostly by ISO 639-1). @@ -208,6 +208,7 @@ \_preplang sv Swedish sv 239 22 \_preplang th Thai th 240 23 \_preplang ethi Ethiopic mul-ethi 241 11 +\_preplang fis schoolFinnish fi-x-school 242 11 \_doc ----------------------------- The \`\langlist` includes names of all languages which are ready to load @@ -243,3 +244,9 @@ The example shows how to declare such language-specific things. Note that you need not set language-specific phrases (like `\today`) by this code. Another concept is used for such tasks. See the section~\ref[langphrases] for more details. + +\_endinput + +2021-03-29 \_preplang schoolFinnish added +2020-11-11 load patterns without lua code +2020-03-10 released diff --git a/macros/optex/base/luatex-ini.opm b/macros/optex/base/luatex-ini.opm index e0526a48d6..1deeca2b80 100644 --- a/macros/optex/base/luatex-ini.opm +++ b/macros/optex/base/luatex-ini.opm @@ -49,9 +49,7 @@ \_protected\_def \_pdflastobj {\_numexpr\_pdffeedback lastobj\_relax} \_protected\_def \_pdflastannot {\_numexpr\_pdffeedback lastannot\_relax} \_def \_pdfxformname {\_pdffeedback xformname} -{\_outputmode=1 - \_xdef\_pdfcreationdate {\_pdffeedback creationdate} -} + \_def \_pdfcreationdate {\_pdffeedback creationdate} \_def \_pdffontname {\_pdffeedback fontname} \_def \_pdffontobjnum {\_pdffeedback fontobjnum} \_def \_pdffontsize {\_pdffeedback fontsize} diff --git a/macros/optex/base/math-macros.opm b/macros/optex/base/math-macros.opm index 2b090ee1b8..efb777a30a 100644 --- a/macros/optex/base/math-macros.opm +++ b/macros/optex/base/math-macros.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \sin {Math macros plus mathchardefs <2021-02-15>} % preloaded in format +\_codedecl \sin {Math macros plus mathchardefs <2021-04-25>} % preloaded in format \_doc ----------------------------- The category code of the character `_` remains as the letter (11) and the mathocode @@ -218,7 +218,7 @@ \_mathchardef\smallint="1273 \_mathchardef\triangleleft="212F \_private \triangleleft; -\_mathchardef\triangleright="212E \_private \trianglerigt; +\_mathchardef\triangleright="212E \_private \triangleright; \_mathchardef\bigtriangleup="2234 \_mathchardef\bigtriangledown="2235 \_mathchardef\wedge="225E \let\land=\wedge @@ -513,10 +513,13 @@ \_protected\_def\Downarrow{\_delimiter"322B37F } \_protected\_def\Updownarrow{\_delimiter"326D377 } \_protected\_def\backslash{\_delimiter"26E30F } % for double coset G\_backslash H -\_protected\_def\rangle{\_delimiter"526930B } \_protected\_def\langle{\_delimiter"426830A } -\_protected\_def\rbrace{\_delimiter"5267309 } \_let\}=\rbrace \_let\_rbrace=\rbrace -\_protected\_def\lbrace{\_delimiter"4266308 } \_let\{=\lbrace \_let\_lbrace=\lbrace +\_protected\_def\rangle{\_delimiter"526930B } +\_protected\_def\lbrace{\_delimiter"4266308 } \_let\_lbrace=\lbrace +\_protected\_def\rbrace{\_delimiter"5267309 } \_let\_rbrace=\rbrace +\_protected\_def\{{\_ifmmode \_lbrace\_else\_char`\{ \_fi} +\_protected\_def\}{\_ifmmode \_rbrace\_else\_char`\} \_fi} + \_protected\_def\rceil{\_delimiter"5265307 } \_protected\_def\lceil{\_delimiter"4264306 } \_protected\_def\rfloor{\_delimiter"5263305 } @@ -716,12 +719,12 @@ \_long\_def\_eqalignno#1{\_display \_tabskip=\_centering \_halign to\_displaywidth{\_hfil$\_elign\_displaystyle{##}$\_tabskip=\_zoskip &$\_elign\_displaystyle{{}##}$\_hfil\_tabskip\_centering - &\_llap{$\_elign##$}\_tabskip\_zoskip\_crcr + &\_hbox to\_zo{\_hss$\_elign##$}\_tabskip\_zoskip\_crcr #1\_crcr}} \_long\_def\_leqalignno#1{\_display \_tabskip=\_centering \_halign to\_displaywidth{\_hfil$\_elign\_displaystyle{##}$\_tabskip=\_zoskip &$\_elign\_displaystyle{{}##}$\_hfil\_tabskip=\_centering - &\_kern-\_displaywidth\_rlap{$\_elign##$}\_tabskip\_displaywidth\_crcr + &\_kern-\_displaywidth\_hbox to\_zo{$\_elign##$\_hss}\_tabskip\_displaywidth\_crcr #1\_crcr}} \_public \openup \eqalignno \leqalignno ; @@ -1063,6 +1066,9 @@ \_endcode %--------------------------------------------------- +2021-04-25 \triangleright: typo fixed +2021-03-22 \(l)eqalignno: \hbox instead \llap, \rlap (\par error suppressed) +2021-03-19 allow text mode \{ and \} 2021-02-15 \_mathbox redefines \_textmff etc. in order to respect optical sizes 2021-02-04 \_bordermatrixwithdelims introduced. 2021-01-23 better expession for math styles in \matrix diff --git a/macros/optex/base/math-unicode.opm b/macros/optex/base/math-unicode.opm index 96f9983380..e9ec87f30f 100644 --- a/macros/optex/base/math-unicode.opm +++ b/macros/optex/base/math-unicode.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \loadmath {Unicode Math fonts <2021-03-09>} % preloaded in format +\_codedecl \loadmath {Unicode Math fonts <2021-04-05>} % preloaded in format \_doc ----------------------------- \`\loadmath` `{<Unicode-math font>}` loads the given font. It does: @@ -88,9 +88,9 @@ \_delimitershortfall=0.5\_fontdimen6\_textfont3 \_nulldelimiterspace=0.12\_fontdimen6\_textfont3 \_scriptspace=0.05\_fontdimen6\_textfont3 - \_begingroup % correction for \choose - \_everymath{}\_global\_setbox0=\_hbox{$\_fam1\_displaystyle{0\_atop0}$}\_endgroup + \_setbox0=\_hbox{\_everymath{}$\_fam1\_displaystyle{0\_atop0}$}% \_Umathfractiondelsize\_displaystyle = \_dimexpr(\_ht0-\_Umathaxis\_displaystyle)*2\_relax + \_setbox0=\_box\_voidbox } \_doc ----------------------------- @@ -258,6 +258,7 @@ the section~\ref[math-macros]. \_endinput +2021-04-04 \_setunimathdimens: \setbox0=\box\voidbox added 2021-03-09 \_setunimathdimes: \_begin/end/group instead {}, bug fixed 2021-02-15 \_textmff, \_scriptmff and \_sscriptmff introduced 2021-02-15 \_expandafter -> \_ea diff --git a/macros/optex/base/more-macros.opm b/macros/optex/base/more-macros.opm index d5ce88c1a6..17e9bdd1e2 100644 --- a/macros/optex/base/more-macros.opm +++ b/macros/optex/base/more-macros.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \eoldef {OpTeX useful macos <2020-05-22>} % preloaded in format +\_codedecl \eoldef {OpTeX useful macros <2021-04-25>} % preloaded in format \_doc ----------------------------- We define \`\opinput` `{<file name>}` macro which @@ -51,17 +51,16 @@ `\_ctablelist` and uses it. \_cod ----------------------------- -\_newcount\_currctable \_currctable=0 \_catcodetable0 -\_def\_setctable#1{\_edef\_ctablelist{{\_the\_currctable}\_ctablelist}% - \_catcodetable#1\_relax \_currctable=#1\_relax +\_def\_setctable#1{\_edef\_ctablelist{{\_the\_catcodetable}\_ctablelist}% + \_catcodetable#1\_relax } \_def\_restorectable{\_ea\_restorectableA\_ctablelist\_relax} \_def\_restorectableA#1#2\_relax{% \_ifx^#2^\_opwarning {You can't use \_noindent\restorectable without previous \_string\setctable}% - \_else \_def\_ctablelist{#2}\_catcodetable#1\_relax \_currctable=#1\_relax \_fi + \_else \_def\_ctablelist{#2}\_catcodetable#1\_relax \_fi } \_def\_ctablelist{.} @@ -76,7 +75,7 @@ \_cod ----------------------------- \_def\_normalcatcodes {\_catcodetable\_optexcatcodes \_savecatcodetable0 \_catcodetable0 } -\_public \normalcatodes ; +\_public \normalcatcodes ; \_doc ----------------------------- The \`\load` `[<filename-list>]` loads files specfied in @@ -279,6 +278,8 @@ \_endcode % ------------------------------------- +2021-04-25 \normalcatcodes: typo fixed +2021-04-22 \the\_currctable replaced by \the\_catcodetable, bug fixed. 2020-05-22 robust \catcode newly defined in order \catcode\string.... be possible 2020-05-03 \load macro introduced 2020-03-15 released diff --git a/macros/optex/base/optex.ini b/macros/optex/base/optex.ini index c695b7d809..d50ffeccf7 100644 --- a/macros/optex/base/optex.ini +++ b/macros/optex/base/optex.ini @@ -21,7 +21,7 @@ % OpTeX version -\def\optexversion{1.01 Mar.2021} +\def\optexversion{1.02 Apr.2021} \def\fmtname{OpTeX} \let\fmtversion=\optexversion @@ -47,7 +47,7 @@ \message{OpTeX (Olsak's Plain TeX) initialization <\optexversion>^^J} \input prefixed.opm % prefixed primitives and code syntax -\input luatex-ini.opm % luaTeX initialization +\input luatex-ini.opm % LuaTeX initialization \input basic-macros.opm % basic macros \input alloc.opm % allocators for registers \input if-macros.opm % special \if-macros, \is-macros and loops @@ -74,7 +74,7 @@ \input sections.opm % titles, chapters, sections \input lists.opm % lists, \begitems, \enditems \input verbatim.opm % verbatim -\input hi-syntax.opm % syntax highlighting of verbatim listimgs +\input hi-syntax.opm % syntax highlighting of verbatim listings \input graphics.opm % graphics \input table.opm % table macro \input multicolumns.opm % more columns by \begmulti ...\endmulti @@ -86,10 +86,10 @@ \input uni-lcuc.opm % Setting lccodes and uccodes for Unicode characters \input hyphen-lan.opm % initialization of hyphenation patterns \input languages.opm % languages -\input others.opm % miscenaleous +\input others.opm % miscellaneous \_directlua{ - % preload OpTeX's lua code into format as bytecode + % preload OpTeX's Lua code into format as bytecode lua.bytecode[1] = assert(loadfile(kpse.find_file("optex", "lua"))) } diff --git a/macros/optex/base/parameters.opm b/macros/optex/base/parameters.opm index c8df6eec49..e03bef6ef3 100644 --- a/macros/optex/base/parameters.opm +++ b/macros/optex/base/parameters.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \normalbaselineskip {Parameter settings <2020-03-17>} % preloaded in format +\_codedecl \normalbaselineskip {Parameter settings <2021-04-13>} % preloaded in format \_doc ----------------------------- \secc Primitive registers @@ -335,11 +335,17 @@ processed after style file is loaded and before printing bib-entries. You can re-define a behavior of the style file here or you can modify the more declaration for printing (fonts, baselineskip, etc.) or you can - define specific macros used in your `.bib` file. + define specific macros used in your `.bib` file.\nl + The \`\biboptions` is used in the `iso690` bib-style for global options, + see section~\ref[isobib].\nl + The \`\bibpart` saves the name of bib-list if there are more bib-lists in + single document, see section~\ref[bib]. \_cod ----------------------------- \_newtoks\_bibtexhook -\_public \bibtexhook ; +\_newtoks\_biboptions +\_newtoks\_bibpart +\_public \bibtexhook \biboptions \bibpart ; \_doc ----------------------------- \`\everycapitonf` is used before printing caption in figures and @@ -584,5 +590,7 @@ a register then \OpTeX/ macros still work without change. \_endinput History: +2021-04-13 ... \bibpart added +2021-04-07 ... \biboptions added, bug from iso690 fixed 2020-04-04 ... \tabspaces added 2020-04-03 ... \hicolors added diff --git a/macros/optex/base/plain-macros.opm b/macros/optex/base/plain-macros.opm index b4569ee969..b878d96ce8 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 <2020-02-14>} % preloaded in format +\_codedecl \magstep {Macros from plain TeX <2021-04-09>} % preloaded in format \_doc ----------------------------- The \`\dospecials` works like in plain TeX but does nothing with `_`. @@ -340,7 +340,9 @@ \_pretolerance=-1 \tolerance=-1 \hbadness=0 \showboxdepth=0 \ #1}} \_def \_bye {\_par \_vfill \_supereject \_byehook \_end} -\_public \bye ; +\_public \showhyphens \bye ; \_endcode % ------------------------------------- +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 61df791ddb..f8edf5d135 100644 --- a/macros/optex/base/prefixed.opm +++ b/macros/optex/base/prefixed.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \public {Prefixing and code syntax <2020-02-14>} % preloaded in format +\_codedecl \public {Prefixing and code syntax <2020-02-25>} % preloaded in format \_doc --------- All \TeX/ primitives have alternative control sequence `\_hbox` `\_string`, ... @@ -27,6 +27,10 @@ \`\private` `<sequence> <sequence> ...;` does `\let \_<sequence> = \<sequence>` for all sequences. \nl + \`\_checkexists` `<where> <prefix><sequence>` prints error + if the control sequence propagated to + a new name space by `\public` etc. macros is not declared. + \nl \`\xargs` `<what> <sequence> <sequence> ... ;` does `<what><sequence>` for each sequences. \_cod ----------------- @@ -37,11 +41,18 @@ \_def \_pkglabel{} \_def \_public {\_xargs \_publicA} -\_def \_publicA #1{\_ea\_let \_ea#1\_csname _\_csstring #1\_endcsname} - +\_def \_publicA #1{% + \_checkexists \public _#1% + \_ea\_let \_ea#1\_csname _\_csstring #1\_endcsname +} \_def \_private {\_xargs \_privateA} -\_def \_privateA #1{\_ea\_let \_csname _\_csstring #1\_endcsname =#1} - +\_def \_privateA #1{% + \_checkexists \private {}#1% + \_ea\_let \_csname _\_csstring #1\_endcsname =#1% +} +\_def\_checkexists #1#2#3{\_unless \_ifcsname #2\_csstring#3\_endcsname + \_errmessage {\_string#1: \_bslash#2\_csstring#3 must be declared}\_fi +} \_public \public \private \xargs \ea ; \_doc ----------------------- @@ -101,12 +112,16 @@ \_def \_nspublic {\_xargs \_nspublicA} \_def \_nspublicA #1{% + \_checkexists \nspublic {\_pkglabel _}#1% \_unless\_ifx #1\_undefined \_opwarning{\_ea\_ignoreit\_pkglabel\_space redefines the meaning of \_string#1}\_fi - \_ea\_let \_ea#1\_csname \_pkglabel _\_csstring #1\_endcsname} - + \_ea\_let \_ea#1\_csname \_pkglabel _\_csstring #1\_endcsname +} \_def \_nsprivate {\_xargs \_nsprivateA} -\_def \_nsprivateA #1{\_ea\_let \_csname \_pkglabel _\_csstring #1\_endcsname =#1} +\_def \_nsprivateA #1{% + \_checkexists \nsprivate {}#1% + \_ea\_let \_csname \_pkglabel _\_csstring #1\_endcsname =#1% +} \_endcode %---------------------------------------------------- @@ -117,8 +132,8 @@ \secc Prefixing internal control sequences All control sequences used in \OpTeX/ are used and defined with `_` prefix. -The user can be sure that when he/she does `\def\foo` then internal macros of -\OpTeX/ nor \TeX/ primitives will be not damaged. For example +The user can be sure that when he/she does `\def\foo` then neither internal macros of +\OpTeX/ nor \TeX/ primitives will be damaged. For example `\def\if{...}` will not damage macros because \OpTeX/'s macros are using `\_if` instead of `\if`. @@ -127,18 +142,18 @@ sequences: `\word` and `\_word`, for example `\hbox` and `\_hbox`. The first alternative is reserved for users or such control sequences can be re-defined by a user. -\OpTeX/ sets the character `_` as the letter, so it can be used in +\OpTeX/ sets the character `_` as letter, so it can be used in control sequences. When a control sequence begins with this character then it means that it is a primitive or it is used in \OpTeX/ macros as internal. User can redefine such prefixed control sequence only -if he/she explicitly know what happens. +if he/she explicitly knows what happens. We never change catcode of `_`, so internal macros can be -redefined by user without problems if it is desired. We need not -something like `\makealetter` from \LaTeX/. +redefined by user without problems if it is desired. We don't need +something like `\makeatletter` from \LaTeX/. \OpTeX/ defines all new macros as prefixed. For public usage of such macros, -we need to set non-prefixed version. This is done by +we need to set their non-prefixed versions. This is done by \begtt \catcode`\<=13 \public <list of control sequences> ; @@ -147,9 +162,9 @@ we need to set non-prefixed version. This is done by For example \^`\public`` \foo \bar ;` does `\let\foo=\_foo`, `\let\bar=\_bar`. At the end of each code segment in \OpTeX/, the `\_public` macro is used. You -can see, what macros are defined for public usage in this code segment. +can see which macros are defined for public usage in that code segment. -The macro \^`\private` does a reverse job to `\public` with the same syntax. +The macro \^`\private` does the reverse job of `\public` with the same syntax. For example `\private \foo \bar ;` does `\let\_foo=\foo`, `\let\_bar=\bar`. This should be used when an unprefixed variant of a control sequence is declared already but we need the prefixed variant too. @@ -163,7 +178,7 @@ and then the \^`\public` (or `\_public`) macro is used. 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 tokenizer (at empty lines) +sequence `\par`. It is generated by the tokenizer (at empty lines) and used as internal in \TeX/. User can define or declare control sequences with `_` character, for @@ -172,7 +187,7 @@ example `\my_control_sequence`, but with the following exceptions: \begitems * Control sequences which begin with `_` are reserved for \TeX/ primitives, \OpTeX/ internal macros and packages internal macros. -* Control sequences (terminated by non-letter) in the form +* Multiletter control sequences in the form `\<word>_` or `\<word>_<one-letter>`, where <word> is a sequence of letters, are inaccessible, because they are interpreted as `\<word>` followed by `_` or as `\<word>` followed by @@ -182,7 +197,7 @@ example `\my_control_sequence`, but with the following exceptions: \max-M ... is interpreted as \max _M \alpha-{ij} ... is interpreted as \alpha _{ij} \endtt - This feature is implemented using lua code at input processor level, see + This feature is implemented using Lua code at input processor level, see the section~\ref[math-macros] for more details. You can deactivate this feature by \^`\mathsboff`. After this, you can still write `$`$\int$`_a^b$` (Unicode) or `$\int _a^b$` % $∫_a^b$ (Unicode) or $\int _a^b$ @@ -226,7 +241,7 @@ Package writer should use internal names in the form `\_<pgk>_<sequence>`, where `<pkg>` is a package label. For example: `\_qr_utfstring` from `qrcode.opm` package. -The package writer needs not to write repeatedly `\_pkg_foo` `\_pkg_bar` +The package writer does not need to write repeatedly `\_pkg_foo` `\_pkg_bar` etc.\ again and again in the macro file.\fnote {We have not adopted the idea from expl3 language:)} When the \^`\_namespace` `{<pkg>}` @@ -265,8 +280,8 @@ If you are writing a macro file that is intended to be published for \begitems * Don't use control sequences from the user namespace in the macro - bodies if there is not explicit and documented reason to do this. -* Don't declare control sequences in the user namespace if there are not + bodies if there is no explicit and documented reason to do this. +* Don't declare control sequences in the user namespace if there are no explicit and documented reasons to do this. * Use control sequences from \OpTeX/ and primitive namespace in read-only mode, if there is not an explicit and documented reason to @@ -279,14 +294,19 @@ If you are writing a macro file that is intended to be published for twice if another macro or the user needs it explicitly too. * Use \^`\_codedecl` as your first command in the macro file and \^`\_endcode` to close the text of macros. -* Use \^`\_doc` ... \^`\_cod` pairs for documenting the code pieces and/or write - more documentation after the \^`\_endcode` command. +* Use \^`\_doc` ... \^`\_cod` pairs for documenting the code pieces. +* You can write more documentation after the \^`\_endcode` command. +* The \OpTeX/ catcodes are set when \^`\load` your package (i.e. plain \TeX/ + catcodes plus catcode of `_` is 11). If a catcode is changed during + loading your package then it is forgot because \^`\load` returns to catcodes + used before loading package. If you want to offer a catcode changing for + users then insert it to a macro which can be used after loading. \enditems If the macro file accepts these recommendations then it should be named by `<filename>.opm` where `<filename>` differs from file names used directly in \OpTeX/ and from other published macros. -This extension `opm` has precedence before `.tex` when +This extension `.opm` has precedence before `.tex` when the \^`\load` macro is used. The `qrcode.opm` is the first example of how an external macro file for \OpTeX/ @@ -294,5 +314,6 @@ can look like. \endinput +2021-04-25 \_checkexists introduced 2021-02-15 \_expandafter -> \_ea in \_codedecl 2020-02-14 released diff --git a/macros/optex/base/ref-file.opm b/macros/optex/base/ref-file.opm index d594bf88c0..8c459f7de5 100644 --- a/macros/optex/base/ref-file.opm +++ b/macros/optex/base/ref-file.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \openref {File for references <2021-02-05>} % preloaded in format +\_codedecl \openref {File for references <2021-04-13>} % preloaded in format \_doc -------------------------- The \`\_inputref` macro is used in `\everyjob`. It reads `\jobname.ref` file @@ -69,7 +69,7 @@ versa. \_cod ---------------------- -\_def\_REFversion{5} % actual version of .ref files in OpTeX +\_def\_REFversion{6} % actual version of .ref files in OpTeX \_def\_Xrefversion#1{\_ifnum #1=\_REFversion\_relax \_else \_endinput \_fi} \_public \Xrefversion ; % we want to ignore .ref files generated by OPmac @@ -139,3 +139,9 @@ in the document then `.ref` file is not created. For example, you only want to test a simple plain \TeX/ macro, you create `test.tex` file, you do `optex test` and you don't need to see an empty `test.ref` file in your directory. +\_endinput + +History: +2021-04-13 \Xrefversion incremented (6), new format of \_Xbib +2021-02-05 \_ewref introduced +2020-02-14 released diff --git a/macros/optex/base/references.opm b/macros/optex/base/references.opm index 03c8f6955c..a4c2e694db 100644 --- a/macros/optex/base/references.opm +++ b/macros/optex/base/references.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \ref {References <2020-03-03>} % preloaded in format +\_codedecl \ref {References <2021-04-13>} % preloaded in format \_doc ---------------------------- \`\_Xpage` `{<gpageno>}{<pageno>}` saves the parameter pair into \`\_currpage`. @@ -25,16 +25,17 @@ \_def\_bracketspg#1#2{[pg:#1]{#2}} \_doc ---------------------------- - \`\label``[<label>]` saves the decalred label to `\_lastlabel` and + \`\label``[<label>]` saves the declared label to `\_lastlabel` and \`\wlabel``{<text>}` uses the `\_lastlabel` and activates `\_wref\_Xlabel{<label>}{<text>}`. \_cod ---------------------------- \_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 + \_iftrue \_slideshook\_opwarning{Duplicated label [#1], ignored}\_else \_xdef\_lastlabel{#1}\_fi \_fi \_ignorespaces } +\_let \_slideshook=\_relax % redefined if \slides + \slideshow. \_def\_wlabel#1{% \_ifx\_lastlabel\_undefined \_else \_dest[ref:\_lastlabel]% @@ -92,3 +93,7 @@ is created later) or if the reference text is page number then we must read `.ref` file first in order to get appropriate information. See section \ref[ref-file] for more information about `.ref` file concept. +\_endinput + +2021-04-13 ... \_slideshook introduced (used by \slides) +2020-03-03 ... released diff --git a/macros/optex/base/slides.opm b/macros/optex/base/slides.opm index 94fa3afac8..a491d1f5ad 100644 --- a/macros/optex/base/slides.opm +++ b/macros/optex/base/slides.opm @@ -1,6 +1,6 @@ % This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \slideshow {Slides style for OpTeX <2021-03-10>} % loaded on demand by \slides +\_codedecl \slideshow {Slides style for OpTeX <2021-04-22>} % loaded on demand by \slides \_doc ----------------------------- Default margins and design is declared here. @@ -79,7 +79,7 @@ \_newcount\_gilevel \_def\*{*} -\_adef*{\_relax\_ifmmode*\_else\_ea\_startitem\_fi} +\_adef*{\_relax\_ifmmode*\_else\_ea\_startitem\_fi} % defined also in styles.opm \_sdef{_item:X}{\Blue\_raise.2ex\_fullrectangle{.8ex}\_kern.5em} \_sdef{_item:x}{\Blue\_raise.3ex\_fullrectangle{.6ex}\_kern.4em} \_style X @@ -98,7 +98,7 @@ \_sdef{_spg:+}{\_par} \_doc ----------------------------- - The \`\_endslides` is defined as `\_end` primitive, but + The \`\_endslides` is defined as `\_end` primitive (preceeded by `\_byehook`), but slide-designer can redefine it. For example, \ulink[http://petr.olsak.net/optex/optex-tricks.html\#slider]{OpTeX trick 0029} shows how to define clickable navigation to the pages and how to check @@ -107,7 +107,7 @@ The `\bye` macro is redefined here as an alternative to `\pg.`. \_cod ----------------------------- -\_def\_endslides{\_end} +\_def\_endslides{\_byehook \_end} \_def\bye{\_pg.} \_doc ----------------------------- @@ -139,9 +139,9 @@ The code is somewhat more complicated when \^`\layers` is used. Then `<layered-text>` is saved to the \`\_layertext` macro, the material before - it is in \`\_slidepage` box and the material after it is in `\_slidepageB` + it is in \`\_slidepage` box and the material after it is in \`\_slidepageB` box. The pages are completed in the `\loop` which increments the - \`\layernum` register. + \`\layernum` register and prints page by the \`\_printlayers` \_cod ----------------------------- \_newbox\_slidepage \_newbox\_slidepageB @@ -156,10 +156,8 @@ \_sdef{_spg:.}{\_closepage \_endslides} \_sdef{_spg:+}{\_closepage \_incr\_slidelayer \_decr\_pageno \_openslide} \_let\_layers=\_layersactive - \_destboxslide % to prevent hyperlink-dests duplication + \_slidelinks % to prevent hyperlink-dests duplication } -\_def\_destboxslide{\_def\_destbox[##1:##2]{\_isequal{##1}{ref}\_iffalse \_destboxori[##1:##2]\_fi}} - \_def\_openslide{\_setbox\_slidepage=\_vbox\_bgroup\_bgroup \_setilevel \_ifvoid\_slidepage \_else \_unvbox\_slidepage \_nointerlineskip\_lastbox \_fi} \_def\_setilevel{\_loop \_decr\_gilevel \_ifnum\_gilevel<0 \_else \_begitems \_repeat} @@ -186,9 +184,8 @@ } \_def\_layersenv{cannot be inside \_string\layers...\_string\endlayers, ignored} -\_def\_printlayers{\_unvcopy\_slidepage \_nointerlineskip\_lastbox - \_layertext \_endgraf - \_ifdim\_prevdepth>-1000pt \_kern-\_prevdepth \_kern\_dp\_strutbox \_fi +\_def\_printlayers{\_unvcopy\_slidepage \_prevdepth=\_dp\_slidepage + {\_layertext \_endgraf}% \_vskip\_parskip \_unvcopy\_slidepageB } @@ -198,19 +195,77 @@ \_maxlayers=0 \_long\_def\_layersactive #1 #2\endlayers{% - \_par\_penalty0\_egroup - \_gdef\_layertext{#2}% + \_par\_penalty0\_egroup\_egroup + \_gdef\_layertext{\_settinglayer#2}% \_global\_maxlayers=#1 - \_setbox\_slidepageB=\_vbox\_bgroup + \_setbox\_slidepageB=\_vbox\_bgroup\_bgroup + \_setbox0=\_vbox{{\_layernum=1 \_globaldefs=-1 \_layertext\_endgraf}}\_prevdepth=\_dp0 } +\_public \subtit \slideshow \pg \wideformat \use \pshow \layernum ; + + \_doc ----------------------------- + \`\slideopen` should be used instead \^`\slideshow` to deactivate it + but keep the borders of groups. + \_cod ----------------------------- + \_def\_slideopen{\_let\slideshow=\_relax % first wins \_sdef{_spg:;}{\_egroups\_vfil\_break \_lfnotenumreset\_bgroup \_setilevel} \_sdef{_spg:.}{\_egroups\_endslides} \_sdef{_spg:+}{\_egroups\_bgroup \_setilevel} + \_let\_layersopen=\_egroup \_let\_layersclose\_bgroup \_bgroup } +\_public \slideopen ; + + \_doc ----------------------------- + When \^`\slideshow` is active then the destinations of internal hyperlinks + cannot be duplicated to more \"virtual" pages because + hyperlink destinations have to be unique in the whole document. + + The \^`\slideshow` creates boxes of typesetting material and copies them to + more pages. So, we have to suppress creating destinations in these boxes. + This is done in the \`\_slidelinks` macro. We + can move creating these destinations to the output routine. \`\_sdestbox` is + saved value of the original `\_destbox` which is redefined to do only + `\addto\_destboxes{\_sdestbox[<label>]}`. All destinations saved to + \`\_destboxes` are created at the start of the next output routine in the + \^`\_pagedest` macro. The output routine removes `\_destboxes`, so each + destination is created only once. + + Limitations of this solution: destinations are only at the start of the + page, no at the real place where \^`\wlabel` was used. The first \"virtual" + page where \^`\wlabel` is used includes its destination. If you want to + go to the final page of the partially uncovering ideas then + use \^`\label``[<label>]`\^`\wlabel``{text}` in the last part of + the page (before `\pg;`) o use \^`\pgref` instead \^`\ref`. + \_cod ----------------------------- + +\_def\_slidelinks{% + \_def \_destbox[##1]{\_edef\_tmp{\_noexpand\_sdestbox[##1]}% + \_global\_ea\_addto\_ea\_destboxes\_ea{\_tmp}}% + \_def \_pagedest {% + \_hbox{\_def\_destheight{25pt}\_sdestbox[pg:\_the\_gpageno]\_destboxes}% + \_nointerlineskip \_gdef\_destboxes{}% + }% + \_ifx \_dest\_destactive \_else \_let\_pagedest=\_relax \_fi +} +\_let\_sdestbox = \_destbox +\_def\_destboxes{} % initial value of \_destboxes +\_let\_bibgl=\_global % \advance\bibnum must be global if they are at more pages -\_public \subtit \slideshow \slideopen \pg \wideformat \use \pshow \layernum ; + \_doc ----------------------------- + The \`\_settinglayer` is used in the \^`\_layertext` macro to prevent + printing \"Duplicate label" warning when it is expanded. It is done + by special value of \`\_slideshook` (used by the \^`\label` macro). + Moreower, the warning about illegal use of `\bib`, `\usebib` in `\layers` + environment is activated. + \_cod ----------------------------- + +\_def\_settinglayer{% + \_def\_slideshook ##1##2{}% + \_def\_bibB[##1]{\_nousebib}\_def\_usebib/##1 (##2) ##3 {\_nousebib}% +} +\_def\_nousebib{\_opwarning{Don't use \noexpand\bib nor \noexpand\usebib in \string\layers}} \_doc ----------------------------- Default \`\layers` `<num>` macro (when \^`\slideshow` is not activated) is simple. @@ -218,8 +273,10 @@ result after last layer is processed. \_cod ----------------------------- -\_def\_layers #1 {\_par\_layernum=\_numexpr#1+1\_relax} -\_let\endlayers=\_relax +\_long\_def\_layers #1 #2\endlayers{\_par + \_layersopen {\_layernum=\_numexpr#1+1\_relax #2\_endgraf}\_layersclose} +\_let\_layersopen=\_relax +\_let\_layersclose=\_relax \_def\layers{\_layers} @@ -240,6 +297,13 @@ The user manual of \OpTeX/ slides are in `op-slides.tex` file. +2021-04-22 \adef* moved back, bug fixed in more-macros.opm +2021-04-21 \adef* removed from slides.opm, bug fixed +2021-04-19 \_byehook added to \_endslides. +2021-04-13 hyperlinks destinations are moved to the output routine when \slideshow +2021-04-10 \layers: \prevdepth calculation added, {\_layertext} group added +2021-04-10 \layers: bug with \setbox\_slidepageB fixed +2021-04-10 \layers: \vskip\parskip added after \unvcopy\_slidepage 2021-03-10 \slideopen introduced, bug with colors in \setbox fixed 2021-03-10 \ifmmode* added to \adef* 2021-02-15 \_def\_decr removed diff --git a/macros/optex/base/table.opm b/macros/optex/base/table.opm index a4a6511958..f32bf311ab 100644 --- a/macros/optex/base/table.opm +++ b/macros/optex/base/table.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \table {Basic macros for OpTeX <2021-03-09>} % preloaded in format +\_codedecl \table {Basic macros for OpTeX <2021-04-12>} % preloaded in format \_doc ----------------------------- The result of the \`\table``{<declaration>}{<data>}` macro is inserted into @@ -213,7 +213,7 @@ \_def\_tabdeclarer{\_the\_tabiteml\_hfil##\_unsskip\_the\_tabitemr} \_def\_paramtabdeclarep#1{\_the\_tabiteml \_vtop{\_hsize=#1\_relax \_baselineskip=\_normalbaselineskip - \_lineskiplimit=\_zo \_noindent##\_unsskip + \_lineskiplimit=\_zo \_noindent \_hskip\_zo \_relax ##\_unsskip \_ifvmode\_vskip\_dp\_tstrutbox \_else\_lower\_dp\_tstrutbox\_hbox{}\_fi}\_the\_tabitemr} \_doc ----------------------------- @@ -512,6 +512,7 @@ after the second one. \_endinput +2021-04-12 p declarator: \hskip0pt added to allow first word hyphenated 2021-03-09 \_tablepxpreset introduced 2021-02-15 \_expandafter -> \_ea 2021-01-27 \_tableB: \long\def added, \vspan syntax improved diff --git a/macros/optex/base/uni-lcuc.opm b/macros/optex/base/uni-lcuc.opm index 2a99f52d66..e56b3b9228 100644 --- a/macros/optex/base/uni-lcuc.opm +++ b/macros/optex/base/uni-lcuc.opm @@ -1,12 +1,20 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -% Preloaded in format. A copy o uni-lcuc.tex fom csplain is here: +\_wterm{Setting lccodes and uccodes for Unicode characters <2021-04-07>} % preloaded in format. -% uni-lcuc.tex -- sets \lccodes and \uccodes for Unicode chars, nothing more -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Petr Olsak, Jul. 2014 +\_isfile{UnicodeData.txt}\_iftrue +\_begingroup + \_sdef{lc:Ll}#1#2#3#4{\_global\_lccode"#2="#2 \_global\_uccode"#2="0#3 } + \_sdef{lc:Lu}#1#2#3#4{\_global\_lccode"#2="0#4 \_global\_uccode"#2="#2 } + \_sdef{lc:Lo}#1#2#3#4{\_global\_lccode"#2="#2 \_global\_uccode"#2="#2 } + \_def\_pa#1;#2;#3;#4;#5;#6;#7;#8;#9;{\_ifx;#1;\_else\_ea\_pb\_fi{#1}{#3}} + \_def\_pb#1#2#3;#4;#5;#6;#7;#8 {\_csname lc:#2\_endcsname\_pc{#1}{#6}{#7}\_pa} + \_def\_pc#1#2#3{} % ignored if the character hasn't Ll, Lu, nor Lo type + \_everyeof={;;;;;;;;;} % end of file + \_ea\_pa\_input UnicodeData.txt +\_endgroup \_endinput \_fi % \endinput here, if UnicodeData.txt was loaded -\_wterm{Setting lccodes and uccodes for Unicode characters} +% If UnicodeData.txt not found, we have internal copy here from csplain, 2014: \_def\_tmp #1 #2 {\_ifx^#1^\_else \_lccode"#1="#1 @@ -15928,17 +15936,30 @@ E01EF . % end of file \_endcode -All codes in unicode table keep information about pairs lowecase-uppercase +All codes in Unicode table keep information about pairs lowecase-uppercase letters or single letter. We need to read such information and set appropriate `\lccode` and `\uccode`. The `\catcode` above the code 127 is not set, i.\,e.\ the `\catcode`=12 for all codes above 127. -The file `uni-lcuc.opm` does this work. It is not much interesting file, only -first few lines from 15928 lines in total is shown here. +The file `UnicodeData.txt` is read if this file exists in your \TeX/ +distribution. The format is specified +at \url{http://www.unicode.org/L2/L1999/UnicodeData.html}. We read only `Ll` +(lowercase letters), `Lu` (upperase letters) and `Lo` (other letters) and +set appopriate codes. The scanner of `UnicodeData.txt` is implemented here +in the group (lines 6 to 15). After the group is closed then +the file `uni-lcuc.opm` is leaved by `\endinput`. + +If the file `UnicodeData.txt` does not exsists then internal data are used. +They follow to the end of the file `uni-lcuc.opm`. {\everytt={\typosize[8/10]\_let\_printverbline=\_printcodeline \medskip}\ttline=-1 \def\docfile{uni-lcuc.opm} -\verbinput (3-30) uni-lcuc.opm +\verbinput (3-39) uni-lcuc.opm \vskip-\medskipamount -\noindent\typosize[8/]\dots etc. (see {\tt\Brown\docfile}) +\noindent\typosize[8/]\dots etc., 15900 similar lines (see {\tt\Brown\docfile}) } + +\_endinput + +2021-04-07 ... UnicodeData.txt scanner implemented +2020-03-10 ... released diff --git a/macros/optex/base/unimath-codes.opm b/macros/optex/base/unimath-codes.opm index 6e83ab94ad..d7f0d387ef 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-03-11>} % preloaded on demand by \loadmath +\_codedecl \_ncharrmA {Uni math codes <2021-04-25>} % preloaded on demand by \loadmath \_doc ----------------------------- The control sequences for `\alpha`, `\beta` etc are redefined here. @@ -68,12 +68,30 @@ \_protected\_def\_bigreek {\_umathrangegreek71\_greekbia} \_protected\_def\_bsansgreek {\_umathrangegreek71\_greeksna} \_protected\_def\_bisansgreek{\_umathrangegreek71\_greeksia} -\_protected\_def\_itGreek {\_umathrangeGREEK71\_greekitA} -\_protected\_def\_rmGreek {\_umathrangeGREEK71\_greekrmA} -\_protected\_def\_bfGreek {\_umathrangeGREEK71\_greekbfA} -\_protected\_def\_biGreek {\_umathrangeGREEK71\_greekbiA} -\_protected\_def\_bsansGreek {\_umathrangeGREEK71\_greeksnA} -\_protected\_def\_bisansGreek{\_umathrangeGREEK71\_greeksiA} +\_protected\_def\_itGreek {\_umathrangeGREEK71\_greekitA \_setnablait} +\_protected\_def\_rmGreek {\_umathrangeGREEK71\_greekrmA \_setnablarm} +\_protected\_def\_bfGreek {\_umathrangeGREEK71\_greekbfA \_setnablabf} +\_protected\_def\_biGreek {\_umathrangeGREEK71\_greekbiA \_setnablabi} +\_protected\_def\_bsansGreek {\_umathrangeGREEK71\_greeksnA \_setnablabsans} +\_protected\_def\_bisansGreek{\_umathrangeGREEK71\_greeksiA \_setnablabisans} + + \_doc ----------------------------- + \`\_setnabla` is used in order to `\nabla` behaves like uppercase Greek + letter, similar like `\Delta`. It depends on `\bf`, `\it` etc. selectors. + If you want to deactivate this behavior, use `\def\_setnabla#1 {}`. + \_cod ----------------------------- + +\_def \_setnabla {\_Umathcode"2207 = 7 1} +\_def \_setnablarm {\_setnabla"02207 } +\_def \_setnablabf {\_setnabla"1D6C1 } +\_def \_setnablait {\_setnabla"1D6FB } +\_def \_setnablabi {\_setnabla"1D735 } +\_def \_setnablabsans {\_setnabla"1D76F } +\_def \_setnablabisans {\_setnabla"1D7A9 } + + \_doc ----------------------------- + Digits are configured like math alphabets. + \_cod ----------------------------- \_chardef\_digitrmO=`0 \_chardef\_digitbfO="1D7CE @@ -90,8 +108,7 @@ \_protected\_def\_ttdigits {\_umathrange{0-9}71\_digitttO} \_doc ----------------------------- - The \`\cal`, \`\bbchar`, \`\frak`, \`\script` - and + The \`\cal`, \`\bbchar`, \`\frak`, \`\script` and the \`\rm`, \`\bf`, \`\it`, \`\bi`, \`\tt` are defined here. Their \"8bit definitions" from the file `math-preload.opm` (section~\ref[math-preload]) are removed.\nl @@ -114,7 +131,7 @@ % \bf and \bi behave as sans serif in math, ... \_protected\_def\_rm {\_tryloadrm \_tenrm \_inmath{\_rmvariables \_rmdigits}} -\_protected\_def\_it {\_tryloadit \_tenit \_inmath{\_itvariables}} +\_protected\_def\_it {\_tryloadit \_tenit \_inmath{\_itvariables \_itGreek}} \_protected\_def\_bf {\_tryloadbf \_tenbf \_inmath{\_bsansvariables \_bsansgreek \_bsansGreek \_bsansdigits}} \_protected\_def\_bi @@ -132,33 +149,28 @@ \_doc ----------------------------- Each Unicode slot carries information about math type. This is saved in - the file `mathclass.txt` which is copied to `mathclass.opm` The file + the file `MathClass-15.txt` which is copied to `mathclass.opm` The file has the following format: {\vitt{mathclass.opm}\verbinput (70-85) mathclass.opm } We have to read this information and convert it to the `\Umathcode`s. \_cod ----------------------------- \_begingroup % \input mathclass.opm (which is a copy of MathClass.txt): - \_def\_p#1;#2{\_edef\_tmp{\_pB#2}\_ifx\_tmp\_empty \_else\_pA#1....\_end#2\_fi} + \_long\_def\_p#1;#2 {\_ifx^#2^\_else + \_edef\_tmp{\_csname _c:#2\_endcsname}\_if\_relax\_tmp\_else \_pA#1....\_end#2\_fi + \_ea\_p \_fi } \_def\_pA#1..#2..#3\_end#4{% - \_ifx\_relax#2\_relax \_pset{"#1}{#4}\_else - \_umathnumA="#1 - \_loop - \_pset{\_umathnumA}{#4}% - \_ifnum\_umathnumA<"#2 \_advance\_umathnumA by1 - \_repeat - \_fi + \_ifx\_relax#2\_relax \_pset{"#1}{#4}\_else \_fornum "#1.."#2\_do{\_pset{##1}{#4}}\_fi } - \_def\_pB#1{\_if#1L1\_fi \_if#1B2\_fi \_if#1V2\_fi \_if#1R3\_fi \_if#1N0\_fi \_if#1U0\_fi - \_if#1F0\_fi \_if#1O4\_fi \_if#1C5\_fi \_if#1P6\_fi \_if#1A7\_fi} - \_def\_pset#1#2{\_global\_Umathcode#1=\_tmp\_space 1 #1\_relax - \_if#2O\_global\_Udelcode#1=1 #1\_relax\_fi - \_if#2C\_global\_Udelcode#1=1 #1\_relax\_fi - \_if#2F\_global\_Udelcode#1=1 #1\_relax\_fi + \_sdef{_c:L}{1}\_sdef{_c:B}{2}\_sdef{_c:V}{2}\_sdef{_c:R}{3}\_sdef{_c:N}{0}\_sdef{_c:U}{0} + \_sdef{_c:F}{0}\_sdef{_c:O}{4}\_sdef{_c:C}{5}\_sdef{_c:P}{6}\_sdef{_c:A}{7} + \_def\_pset#1#2{\_Umathcode#1=\_tmp\_space 1 #1\_relax + \_if#2O\_Udelcode#1=1 #1\_relax\_fi + \_if#2C\_Udelcode#1=1 #1\_relax\_fi + \_if#2F\_Udelcode#1=1 #1\_relax\_fi } - \_catcode`#=14 - \_everypar={\_setbox0=\_lastbox \_par \_p} - \_setbox0=\_vbox{\_input mathclass.opm } + \_catcode`#=14 \_everyeof={;{} } \_def\par{} + \_globaldefs=1 \_ea \_p \_input mathclass.opm \_endgroup \_doc ----------------------------- @@ -171,13 +183,13 @@ \_begingroup % \input unimath-table.opm (it is a copy of unicode-math-table.tex): \_def\UnicodeMathSymbol #1#2#3#4{% \_ifnum#1=\_Umathcodenum#1 % the code isn't set by mathclass.opm - \_global\_Umathchardef#2=0 1 #1 \_global\_Umathcode#1=0 1 #1 - \_else \_global\_Umathcharnumdef#2=\_Umathcodenum#1 \_fi - \_ifx#3\_mathopen \_gdef#2{\_Udelimiter 4 1 #1 }\_fi - \_ifx#3\_mathclose \_gdef#2{\_Udelimiter 5 1 #1 }\_fi - \_ifx#3\_mathaccent \_gdef#2{\_Umathaccent fixed 7 1 #1 }\_fi + \_Umathchardef#2=0 1 #1 \_Umathcode#1=0 1 #1 + \_else \_Umathcharnumdef#2=\_Umathcodenum#1 \_fi + \_ifx#3\_mathopen \_def#2{\_Udelimiter 4 1 #1 }\_fi + \_ifx#3\_mathclose \_def#2{\_Udelimiter 5 1 #1 }\_fi + \_ifx#3\_mathaccent \_def#2{\_Umathaccent fixed 7 1 #1 }\_fi } - \_input unimath-table.opm + \_globaldefs=1 \_input unimath-table.opm \_endgroup \_doc ----------------------------- @@ -195,8 +207,6 @@ % mathclass defines : as Punct, plain.tex as Rel, we keep mathclass, % i.e. there is difference from plain.tex, you can use $f:A\to B$. -\_let\{=\lbrace \_let\}=\rbrace - % mathclas defines ! as Ord, plain.tex as Close \_Umathcode `! = 5 1 `! % keep plain.tex declaration \_Umathchardef \mathexclam = 5 1 `! @@ -210,6 +220,8 @@ \_protected\_def \_cuberoot {\_Uradical 1 "0221B } \_protected\_def \_fourthroot {\_Uradical 1 "0221C } +\_def \nabla {^^^^2207} % \nabla behaves as uppercase Gereek letter, see \_setnabla + \_public \sqrt \cuberoot \fourthroot ; \_def\_intwithnolimits#1#2 {\_ifx#1\_relax \_else @@ -405,9 +417,9 @@ \_cod ----------------------------- \_private - \ldotp \cdotp \bullet \triangleleft \trianglerigt \mapstochar \rightarrow + \ldotp \cdotp \bullet \triangleleft \triangleright \mapstochar \rightarrow \prime \lhook \rightarrow \leftarrow \rhook \triangleright \triangleleft - \Relbar \Rightarrow \relbar \rightarrow \Leftarrow \mapstochar + \rbrace \lbrace \Relbar \Rightarrow \relbar \rightarrow \Leftarrow \mapstochar \longrightarrow \Longleftrightarrow \unicodevdots \unicodeddots \unicodeadots ; \_endcode @@ -427,6 +439,11 @@ for technical details about Unicode-math. \_endinput History: +2021-04-25 \triangleright: typo fixed +2021-04-20 reading mathclass.opm improved +2021-04-07 \_setnabla introduced, \nabla as uppercase Greek letter +2021-03-26 \it does \_itGreek +2021-03-19 \{, \} are defined as mode independent macros in math-macros.opm 2021-03-11 Umathcode `* declaed as \ast 2021-02-03 Unicode superscripts, subscripts declared 2021-01-31 Mathcode of ! ? set to Close, codes undeclared in mathclass set correctly diff --git a/macros/optex/base/usebib.opm b/macros/optex/base/usebib.opm index f37d21b315..9dbd475241 100644 --- a/macros/optex/base/usebib.opm +++ b/macros/optex/base/usebib.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \MakeReference {Reading bib databases <2021-03-12>} % loaded on demand by \usebib +\_codedecl \MakeReference {Reading bib databases <2021-04-13>} % loaded on demand by \usebib \_doc ----------------------------- Loading the `librarian.tex` macro package. See `texdoc librarian` @@ -24,14 +24,13 @@ \_cod ----------------------------- \_def\_usebib/#1 (#2) #3 {% - \_let\_citeI=\_relax \_xdef\_citelist{\_citelist\_citelistB}% - \_global\_let\_addcitelist=\_writeXcite + \_let\_citeI=\_relax \_xdef\_citelist{\_trycs{_ctlst:\_bibp}{}\_trycs{_ctlstB:\_bibp}{}}% + \_global \_ea\_let \_csname _ctlst:\_bibp\_endcsname =\_write \_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 \_ea \_skiptoendinput \_input languages.opm @@ -48,10 +47,10 @@ \_input #3.bib \_ea}\_ea\_def\_ea\_citelist\_ea{\_citelist}% \_fi - \_def\_citeI[##1]{\_csname lb@cite\_endcsname{##1}{\_bibpart}{}{}}\_citelist + \_def\_citeI[##1]{\_csname lb@cite\_endcsname{##1}{\_bibp}{}{}}\_citelist \_BibFile{#3}% - \_if s#1\_SortList{\_bibpart}\_fi - \_ReadList{\_bibpart}% + \_if s#1\_SortList{\_bibp}\_fi + \_ReadList{\_bibp}% \_restorectable \_egroup \_fi @@ -117,13 +116,13 @@ \_cod ----------------------------- \_def\MakeReference{\_par \_bibskip - \_advance\_bibnum by1 - \_isdefined{_bim:\_the\_bibnum}\_iftrue - \_edef\_tmpb{\_csname _bim:\_the\_bibnum\_endcsname}% + \_bibgl\_advance\_bibnum by1 + \_isdefined{_bim:\_bibp\_the\_bibnum}\_iftrue + \_edef\_tmpb{\_csname _bim:\_bibp\_the\_bibnum\_endcsname}% \_bibmark=\_ea{\_tmpb}% \_else \_bibmark={}\_fi \_edef\_tmpb{\EntryKey}% - \_noindent \_dest[cite:\_the\_bibnum]\_printlabel\EntryKey + \_noindent \_dbib\EntryKey \_printbib {% \_RetrieveFieldIn{entrytype}\_entrytype @@ -136,8 +135,7 @@ \_csname _print:misc\_endcsname \_fi\_fi \_csname _print:END\_endcsname - \_ifx\_wref\_wrefrelax\_else - \_immediate\_wref\_Xbib{{\EntryKey}{\_the\_bibnum}{\_the\_bibmark}}\_fi + \_wbib \EntryKey {\_the\_bibnum}{\_the\_bibmark}% }\_par } @@ -369,7 +367,8 @@ character is sorted before `A`. History: -------- - +2021-04-13 \bibpart implemented +2021-04-13 \_bibgl introduced (used by \slides) 2021-03-12 \_citelistB added before first test. 2021-02-15 \_expandafter -> \_ea Apr. 2014: released in OPmac diff --git a/macros/optex/base/verbatim.opm b/macros/optex/base/verbatim.opm index 8fd20ee531..08748eb5a6 100644 --- a/macros/optex/base/verbatim.opm +++ b/macros/optex/base/verbatim.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \begtt {Verbatim <2021-01-22>} % preloaded in format +\_codedecl \begtt {Verbatim <2021-04-18>} % preloaded in format \_doc ---------------------------- The internal parameters @@ -125,15 +125,16 @@ \_ifnum\_ttline<0 \_let\_printverblinenum=\_relax \_else \_initverblinenum \_fi \_adef{ }{\_dsp}\_adef\^^I{\t}\_parindent=\_ttindent \_parskip=0pt \_def\t{\_hskip \_dimexpr\_tabspaces em/2\_relax}% + \_protrudechars=0 % disable protrusion \_the\_everytt \_relax #1\_relax \_ttfont \_def\_testcommentchars##1\_iftrue{\_iffalse}\_let\_hicomments=\_relax - \_endlinechar=`^^J + \_savemathsb \_endlinechar=`^^J \_startverb } \_ea\_def\_ea\_startverb \_ea#\_ea1\_csstring\\endtt#2^^J{% \_prepareverbdata\_tmpb{#1^^J}% \_ea\_printverb \_tmpb\_end - \_par + \_par \_restoremathsb \_endgroup \_ttskip \_isnextchar\_par{}{\_noindent}% } @@ -246,8 +247,9 @@ \_ifnum\_ttline<-1 \_let\_printverblinenum=\_relax \_else \_initverblinenum \_fi \_setverb \_adef{ }{\_dsp}\_adef\^^I{\t}\_parindent=\_ttindent \_parskip=0pt \_def\t{\_hskip \_dimexpr\_tabspaces em/2\_relax}% + \_protrudechars=0 % disable protrusion \_the\_everytt\_relax \_tmpb\_relax \_ttfont - \_endlinechar=`^^J \_tmpnum=0 + \_savemathsb \_endlinechar=`^^J \_tmpnum=0 \_loop \_ifeof\_vifile \_tmpnum=\_vinolines\_space \_fi \_ifnum\_tmpnum<\_vinolines\_space \_vireadline \_advance\_tmpnum by1 \_repeat %% skip lines @@ -265,7 +267,7 @@ \_catcode`\ =10 \_catcode`\%=9 % used in \commentchars comments \_ea\_printverb \_tmpb\_end \_global\_ttlinesave - \_par + \_par \_restoremathsb \_endgroup \_ttskip \_isnextchar\_par{}{\_noindent}% @@ -276,6 +278,17 @@ \_public \verbinput ; \_doc ----------------------------- + \`\_savemathsb`, \`\_restoremathsb` pair is used + in \^`\begtt`...\^`\endtt` or in \^`\verbinput` to temporary suppress + the \^`\mathsbon` because we don't need to print `\int _a` + in verbatim mode if `\int``_a` is really written. The \^`\_restoremathsb` + is defined locally as \^`\mathsbon` only if it is needed. + \_cod ----------------------------- + +\_def\_savemathsb{\_ifmathsb \_mathsboff \_def\_restoremathsb{\_mathsbon}\_fi} +\_def\_restoremathsb{} + + \_doc ----------------------------- If the language of your code\label[commentchars]\wlabel{} printed by \^`\verbinput` supports the format of comments started by two characters from the beginning of the @@ -363,7 +376,9 @@ \_endinput History: -2020-01-22 ... \activettchar changed to \verbchar +2021-04-18 ... \_protrudechars=0 added +2021-04-07 ... \_savemathsb, \_restoremathsb introduced +2021-01-22 ... \activettchar changed to \verbchar 2020-12-30 ... \secc followed by \begtt must be unbreakable 2020-11-13 ... \commentchars implemented 2020-04-22 ... \ttshift introduced |