From b153d9b098596910fb2be9311f13c4415233c2a2 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 4 Dec 2022 03:01:36 +0000 Subject: CTAN sync 202212040301 --- macros/optex/base/alloc.opm | 5 +- macros/optex/base/basic-macros.opm | 22 +- macros/optex/base/bib-simple.opm | 49 ++--- macros/optex/base/cite-bib.opm | 2 +- macros/optex/base/doc.opm | 34 +-- macros/optex/base/f-heros.opm | 17 +- macros/optex/base/f-iwona.opm | 26 +++ macros/optex/base/f-kurier.opm | 26 +++ macros/optex/base/f-lato.opm | 34 +++ macros/optex/base/fams-ini.opm | 19 +- macros/optex/base/fnotes.opm | 4 +- macros/optex/base/fonts-catalog.opm | 2 +- macros/optex/base/fonts-resize.opm | 72 +++++-- macros/optex/base/fonts-select.opm | 25 ++- macros/optex/base/graphics.opm | 12 +- macros/optex/base/hi-syntax.opm | 20 +- macros/optex/base/hyperlinks.opm | 6 +- macros/optex/base/if-macros.opm | 63 +++++- macros/optex/base/lang-data.opm | 24 ++- macros/optex/base/lang-decl.opm | 16 +- macros/optex/base/languages.opm | 7 +- macros/optex/base/makeindex.opm | 6 +- macros/optex/base/math-preload.opm | 63 +++--- macros/optex/base/math-unicode.opm | 343 ----------------------------- macros/optex/base/more-macros.opm | 119 +++++++++-- macros/optex/base/multicolumns.opm | 7 +- macros/optex/base/optex.ini | 6 +- macros/optex/base/optex.lua | 107 +++++++--- macros/optex/base/others.opm | 8 +- macros/optex/base/output.opm | 7 +- macros/optex/base/pdfuni-string.opm | 12 +- macros/optex/base/plain-macros.opm | 19 +- macros/optex/base/prefixed.opm | 178 ++++++++++----- macros/optex/base/ref-file.opm | 2 +- macros/optex/base/references.opm | 6 +- macros/optex/base/sections.opm | 27 ++- macros/optex/base/table.opm | 14 +- macros/optex/base/unimath-codes.opm | 65 +++--- macros/optex/base/unimath-macros.opm | 404 +++++++++++++++++++++++++++++++++++ macros/optex/base/verbatim.opm | 10 +- 40 files changed, 1208 insertions(+), 680 deletions(-) create mode 100644 macros/optex/base/f-iwona.opm create mode 100644 macros/optex/base/f-kurier.opm create mode 100644 macros/optex/base/f-lato.opm delete mode 100644 macros/optex/base/math-unicode.opm create mode 100644 macros/optex/base/unimath-macros.opm (limited to 'macros/optex/base') diff --git a/macros/optex/base/alloc.opm b/macros/optex/base/alloc.opm index ae77d3074e..d4f823fec4 100644 --- a/macros/optex/base/alloc.opm +++ b/macros/optex/base/alloc.opm @@ -121,10 +121,9 @@ \_doc ----------------------------- A few registers are initialized like in plain\TeX/. We absolutely don't support the `@`category dance, so `\z@skip` - `\z@`, `\p@` etc. are not defined in \OpTeX/. If you need such - control sequences then you can initialize them by `\load[plain-at]`. + `\z@`, `\p@` etc. are defined but not recommended in \OpTeX/. - Only the \`\_zo` and \`\_zoskip` (equivalents to `\z@` and `\z@skip`) + The \`\_zo` and \`\_zoskip` (equivalents to `\z@` and `\z@skip`) are declared here and used in some internal macros of \OpTeX/ for improving speed. \_cod ----------------------------- diff --git a/macros/optex/base/basic-macros.opm b/macros/optex/base/basic-macros.opm index 2e8c98d6e3..ae5c833140 100644 --- a/macros/optex/base/basic-macros.opm +++ b/macros/optex/base/basic-macros.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \sdef {Basic macros for OpTeX <2021-07-20>} % preloaded in format +\_codedecl \sdef {Basic macros for OpTeX <2022-11-22>} % preloaded in format \_doc ------------------------------ \`\bgroup`, \`\egroup`, \`\empty`, \`\space`, and \`\null` @@ -77,11 +77,15 @@ \_public \cs \trycs ; \_doc ------------------------------ - \`\addto` `\macro{}` adds `` to your `\macro`, which must be defined. + \`\addto` `\macro{}` adds `` to your `\macro`, which must be defined.\nl + \`\aheadto` `\macro{}` defines `\macro` as `` followed by the + original `\macro` body. \_cod ------------------------------ \_long\_def \_addto #1#2{\_ea\_def\_ea#1\_ea{#1#2}} -\_public \addto ; +\_long\_def \_aheadto #1#2{\_edef#1{\_unexpanded{#2}\_unexpanded\_ea{#1}}} + +\_public \addto \aheadto ; \_doc ----------------------------- \`\incr``` increases `` by one globally. @@ -112,6 +116,15 @@ \_def\_tracingall{\_tracingonline=1 \_loggingall} \_public \loggingall \tracingall ; + \_doc ------------------------ + The `\optexversion` and `\fmtname` are defined in the `optex.ini` file. + Maybe, somebody will need a private version of these macros. + We add \`\_banner` used in `\everyjob` and in \~`\docgen` + \_cod ------------------------ + +\_def\_banner {This is OpTeX (Olsak's Plain TeX), version <\_optexversion>}% +\_private \optexversion \fmtname ; + \_doc ------------------------------ \`\_byehook` is used in the \^`\bye` macro. Write a warning if the user did not load a Unicode Font. @@ -129,6 +142,9 @@ \_endcode % ------------------------------------- +2022-11-22: \_banner definition moved here +2022-11-18: \ahead introduced +2022-10-29: \_fin introduced 2021-07-20: \_unresovedrefs removed from \_byehook 2021-07-18: \_byehook: checking `ref` file consistency added. 2021-05-16: \slet reimplemented (to allow \slet{foo}{undefined}). diff --git a/macros/optex/base/bib-simple.opm b/macros/optex/base/bib-simple.opm index fe1730ba67..3af9a1b927 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 -\_codedecl \_undefined {BIB style (simple) <2022-05-10>} % loaded on demand by \usebib +\_codedecl \_undefined {BIB style (simple) <2022-10-10>} % loaded on demand by \usebib \_ifx\_optexbibstyle\_undefined \_errmessage {This file can be read by: \_string\usebib/? (simple) bibfiles command only} @@ -36,6 +36,7 @@ } \_def\_preurl{\_hfil\_break} +\_def\_Inclause{In:~} % Non-standard fieldnames: @@ -56,9 +57,9 @@ \_setbibmark } \_sdef{_print:book}{% - \_bprinta [!author] {*\:\ }{\_bibwarning}% - \_bprintb [title] {{\_em##1}.\ }{\_bibwarning}% - \_bprinta [edition] {*~\_mtext{bib.edition}.\ }{}% + \_bprinta [!author] {*.\ }{\_bibwarning}% + \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}% + \_bprinta [edition] {*\_mtext{bib.edition}\ }{}% \_bprinta [address] {*: }{\_bibwarning}% \_bprinta [publisher] {*, }{\_bibwarning}% \_bprinta [year] {*.\ }{\_bibwarning}% @@ -66,21 +67,21 @@ \_bprintb [url] {\_preurl\_url{##1}. }{}% } \_sdef{_print:article}{% - \_bprinta [!author] {*\:\ }{\_bibwarning}% - \_bprinta [title] {*.\ }{\_bibwarning}% - \_bprintb [journal] {{\_em##1}.\ }{\_bibwarning}% - \_bprinta [year] {*, }{}% + \_bprinta [!author] {*.\ }{\_bibwarning}% + \_bprinta [title] {*\:\ }{\_bibwarning}% + \_bprintb [journal] {{\_em##1}\:\ }{\_bibwarning}% + \_bprinta [year] {*\_bprintv[volume,number,pages]{,}{.} }{}% \_bprinta [volume] {* }{}% - \_bprinta [number] {(*), }{}% + \_bprinta [number] {(*)\_bprintv[pages]{,}{.} }{}% \_bprinta [pages] {*.\ }{}% \_bprintb [doi] {DOI~\_ulink[http://dx.doi.org/##1]{##1}.\ }{}% } \_sdef{_print:inbook}{% - \_bprinta [!author] {*\:\ }{\_bibwarning}% - \_bprintb [title] {{\_em##1.}\ }{\_bibwarning}% - In:~% + \_bprinta [!author] {*.\ }{\_bibwarning}% + \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}% + \_Inclause \_bprinta [!editor] {*,~eds.\ }{}% - \_bprintb [booktitle] {{\_em##1}.\ }{\_bibwarning}% + \_bprintb [booktitle] {{\_em##1}\:\ }{\_bibwarning}% \_bprinta [address] {*: }{\_bibwarning}% \_bprinta [publisher] {*, }{\_bibwarning}% \_bprinta [year] {*.\ }{\_bibwarning}% @@ -92,12 +93,12 @@ \_slet{_print:inproceedings}{_print:inbook} \_sdef{_print:incolection}{% - \_bprinta [!author] {*\:\ }{\_bibwarning}% - \_bprintb [title] {{\_em##1}.\ }{\_bibwarning}% + \_bprinta [!author] {*.\ }{\_bibwarning}% + \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}% \_bprinta [crossreff] {In~\_cite[*]. }{% \_bprinta [booktitle] {*. }{\_bibwarning}% \_bprinta [!editor] {*,~eds.\ }{\_bibwarning}% - \_bprinta [edition] {*~\_mtext{bib.edition}.\ }{\_bibwarning}% + \_bprinta [edition] {*\_mtext{bib.edition}\ }{\_bibwarning}% \_bprinta [address] {*: }{\_bibwarning}% \_bprinta [publisher] {*, }{\_bibwarning}% \_bprinta [year] {*.\ }{\_bibwarning}% @@ -105,9 +106,9 @@ \_bprintb [url] {\_preurl\_url{####1}. }{}}% } \_sdef{_print:conference}{% - \_bprinta [!author] {*\:\ }{\_bibwarning}% + \_bprinta [!author] {*.\ }{\_bibwarning}% \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}% - \_bprinta [edition] {*~\_mtext{bib.edition}.\ }{}% + \_bprinta [edition] {*\_mtext{bib.edition}\ }{}% \_bprinta [address] {*: }{\_bibwarning}% \_bprinta [publisher] {*, }{\_bibwarning}% \_bprinta [year] {*.\ }{\_bibwarning}% @@ -115,7 +116,7 @@ \_bprintb [url] {\_preurl\_url{##1}. }{}% } \_sdef{_print:thesis}{% - \_bprinta [!author] {*\:\ }{\_bibwarning}% + \_bprinta [!author] {*.\ }{\_bibwarning}% \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}% \_bprinta [type] {*,\ }{\_bibwarning}% \_bprinta [school] {*.\ }{}% @@ -124,31 +125,31 @@ \_bprintb [url] {\_preurl\_url{##1}. }{}% } \_sdef{_print:proceedings}{% - \_bprinta [!author] {*\:\ }{\_bibwarning}% + \_bprinta [!author] {*.\ }{\_bibwarning}% \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}% \_bprinta [publisher] {*.\ }{% \_bprinta [organization] {*.\ }{\_bibwarning}}% } \_sdef{_print:techreport}{% - \_bprinta [!author] {*\:\ }{\_bibwarning}% + \_bprinta [!author] {*.\ }{\_bibwarning}% \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}% \_mtext{bib.techreport}. \_bprinta [institution] {*.\ }{}% } \_sdef{_print:booklet}{% - \_bprinta [!author] {*\:\ }{\_bibwarning}% + \_bprinta [!author] {*.\ }{\_bibwarning}% \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}% \_bprinta [howpublished] {*.\ }{\_bibwarning}% } \_sdef{_print:manual}{% - \_bprinta [!author] {*\:\ }{}% + \_bprinta [!author] {*.\ }{}% \_bprintb [title] {{\_em##1}\:\ }{\_bibwarning}% \_bprinta [year] {*.\ }{}% \_bprinta [institution] {*.\ }{}% \_bprintb [url] {\_preurl\_url{##1}. }{}% } \_sdef{_print:misc}{% - \_bprinta [!author] {*\:\ }{}% + \_bprinta [!author] {*.\ }{}% \_bprintb [title] {{\_em##1}\:\ }{}% \_bprinta [howpublished] {*.\ }{}% \_bprinta [institution] {*.\ }{}% diff --git a/macros/optex/base/cite-bib.opm b/macros/optex/base/cite-bib.opm index adef0eaef8..9dc32a2632 100644 --- a/macros/optex/base/cite-bib.opm +++ b/macros/optex/base/cite-bib.opm @@ -232,7 +232,7 @@ \_cod ----------------------------- \_def\_bib[#1]{\_def\_tmp{\_isnextchar={\_bibA[#1]}{\_bibmark={}\_bibB[#1]}}% - \_ea\_tmp\_romannumeral-`\.} % ignore optional space + \_nospaceafter\_tmp} % ignore optional space \_def\_bibA[#1]=#2{\_bibmark={#2}\_bibB[#1]} \_def\_bibB[#1]{\_par \_bibskip \_bibgl\_advance\_bibnum by1 diff --git a/macros/optex/base/doc.opm b/macros/optex/base/doc.opm index bde1dcc848..dc5d037e72 100644 --- a/macros/optex/base/doc.opm +++ b/macros/optex/base/doc.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \printdoc {Macros for documentation printing <2022-07-01>} % loaded on demand by \load[doc] +\_codedecl \printdoc {Macros for documentation printing <2022-11-21>} % loaded on demand by \load[doc] \_doc ----------------------------- General decalarations. @@ -11,8 +11,10 @@ \_let \mlinkcolor=\Red % main doc. points \_let \ulinkcolor=\Blue % user doc. points \_let \fnamecolor=\Brown % file names in listing headers -\_def \bgverbcolor {\_setcmykcolor{0 0 .3 .03}} % background for listings -\_hyperlinks \Green \Green +\_def \bgverbcolor {\_setcmykcolor{0 0 .3 .03}} % background for listings +\_def \outlinkcolor {\_setcmykcolor{1 0 1 .2}} % green for outerlinks +\_def \inlinkcolor {\_setcmykcolor{0 1 0 .1}} % magenta for internal links +\_hyperlinks \inlinkcolor \outlinkcolor \_enlang \_enquotes @@ -39,7 +41,7 @@ \_doc ----------------------------- The listing mode is implemented here. The \`\maxlines` is maximal lines of code printed in the listing mode. - The \`\_catcodedot` sets dot as letter in listngs (for package + The \code{\\catcode`\\.=11} sets dot as letter in listngs (for package documentation where `\.foo` sequeces exist). \_cod ----------------------------- @@ -52,7 +54,7 @@ \_typosize[8/10] \_let\_printverbline=\_printcodeline \_ttline=\_inputlineno - \_setverb \_catcodedot + \_setverb \_catcode`\.=11 \_ifnum\_ttline<0 \_let\_printverblinenum=\_relax \_else \_initverblinenum \_fi \_adef{ }{\ }\_adef\^^I{\t}\_parindent=\_ttindent \_parskip=0pt \_def\t{\_hskip \_dimexpr\_tabspaces em/2\_relax}% @@ -74,7 +76,6 @@ \_edef\_Doc{\_asp\_asp\_bslash _doc} \_bgroup \_lccode`~=`\^^I \_lowercase{\_egroup\_edef\_Doctab{\_noexpand~\_bslash _doc}} \_edef\_Endcode{\_noexpand\_empty\_bslash _endcode} -\_def\_catcodedot{\_catcode`\.=11 } \_doc ----------------------------- The scanner of the control sequences in the listing mode replaces all @@ -101,16 +102,16 @@ \_def\_processinput{% \_let\_start=\_relax \_ea\_replstring\_ea\_tmpb\_ea{\_aspace^^J}{^^J} - \_addto\_tmpb{\_end}% + \_addto\_tmpb{\_fin}% \_isinlist\_tmpb{\_start^^J}\_iftrue \_advance\_ttline by1\_fi \_replstring\_tmpb{\_start^^J}{\_start}% \_replstring\_tmpb{\_start}{}% - \_replstring\_tmpb{^^J\_end}{\_end}% - \_replstring\_tmpb{^^J\_end}{}% - \_replstring\_tmpb{\_end}{}% + \_replstring\_tmpb{^^J\_fin}{\_fin}% + \_replstring\_tmpb{^^J\_fin}{}% + \_replstring\_tmpb{\_fin}{}% \_ea\_prepareverbdata\_ea\_tmpb\_ea{\_tmpb^^J}% \_replthis{\_csstring\\}{\_noexpand\_makecs}% - \_ea\_printverb \_tmpb\_end + \_ea\_printverb \_tmpb\_fin \_par \_endgroup \_ttskip \_isnextchar\_par{}{\_noindent}% @@ -145,7 +146,7 @@ } \_everytt={\_let\_printverblinenum=\_relax} -\_long\_def\_endverbprinting#1\_end#2\_end{\_fi\_fi \_global\_maxlines=100000 +\_long\_def\_endverbprinting#1\_fin#2\_fin{\_fi\_fi \_global\_maxlines=100000 \_noindent\_typosize[8/]\_dots etc. (see {\_tt\fnamecolor\docfile})} \_doc ----------------------------- @@ -206,10 +207,9 @@ catcodes using the `\_afteroad` macro. \_cod ----------------------------- -\_def\_afterload{\_catcode`\<=13 \_catcode`\`=13 \_catcode`\.=11 - \_wlog {doc.opm: catcodes of < and ` activated, catcode of . is letter.}% +\_def\_afterload{\_catcode`\<=13 \_catcode`\`=13 + \_wlog {doc.opm: catcodes of < and ` activated.}% } -\_catcode`.=11 \_doc ----------------------------- The \code{} will be print as . @@ -219,7 +219,7 @@ \_catcode`\<=13 \_def<#1>{$\langle\hbox{\it#1\/}\rangle$} -\_everyintt{\_catcode`\<=13 } +\_everyintt{\_catcode`\<=13 \_catcode`\.=11 } \_doc ----------------------------- Main documentation points and hyperlinks to/from it. @@ -357,6 +357,8 @@ have the same meaning: `\optexdoclink` in this example. And \endinput +2022-11-21 magenta color for internal links instead green. +2022-11-13 \catcode`.=11: only local settings 2022-07-01 \_printii improved, colors declaration part added. 2021-05-15 \_endinput shifted after \_processinput when \_endcode is scanned. 2021-05-14 \_catcodedot, \_Doctab introduced. diff --git a/macros/optex/base/f-heros.opm b/macros/optex/base/f-heros.opm index 7848b7f9d2..2531573ca4 100644 --- a/macros/optex/base/f-heros.opm +++ b/macros/optex/base/f-heros.opm @@ -21,11 +21,8 @@ Modifiers:^^J \_ifmathloading \_loadmath {[FiraMath-Regular]} - \_addto\_normalmath{\_loadumathfamily 5 {xitsmath-regular}{} } - \_addto\_boldmath {\_loadumathfamily 5 {xitsmath-bold}{} } - \_addto\_frak{\_fam5 }\_addto\_cal{\_fam5 } \_public \frak \cal ; - \_normalmath - \_wterm{MATH-FONT(5): "[XITSMath-Regular/Bold]" -- used for \_string\cal, \_string\frak} + \_addUmathfont \_xits {[XITSMath-Regular]}{} {[XITSMath-Bold]}{} {} + \_addto\_frak{\_fam\_xits}\_addto\_cal{\_fam\_xits} \_public \frak \cal ; % \bf, \bi from FiraMath: \_let\_bsansvariables=\_bfvariables \_let\_bsansGreek=\_bfGreek @@ -34,14 +31,8 @@ Modifiers:^^J \_let\_bisansvariables=\_bivariables \_let\_bisansgreek=\_bigreek % \_resetmathchars ; - \_def\_resetmathchars #1{\_chardef\_mafam=#1\_relax \_xargs \_resetmathcharX} - \_def\_resetmathcharX#1{\_ea\_resetmathcharY - \_directlua{tex.print(string.format("\_pcent08X", \_the#1))}#1} - \_def\_resetmathcharY#1#2#3#4#5#6#7#8#9{% - \_Umathchardef #9\_numexpr"#3/2\_relax \_mafam "#4#5#6#7#8 - \_Umathcode "#4#5#6#7#8=\_numexpr"#3/2\_relax \_mafam "#4#5#6#7#8 } - \_resetmathchars 5 \bigtriangleup \bigblacktriangleup \blacktriangle - \vartriangle \smallblacktriangleright ; % ... etc. you can add more + \_mathchars \_xits {\bigtriangleup \bigblacktriangleup \blacktriangle + \vartriangle \smallblacktriangleright} % ... etc. you can add more \_fi \_endcode diff --git a/macros/optex/base/f-iwona.opm b/macros/optex/base/f-iwona.opm new file mode 100644 index 0000000000..702ac6a06a --- /dev/null +++ b/macros/optex/base/f-iwona.opm @@ -0,0 +1,26 @@ +%% This is part of the OpTeX project, see http://petr.olsak.net/optex + +\_famdecl [Iwona] \Iwona {Sans serif typeface derived from Kurier} + {\caps \cond \light \medium \bolder} {\rm \bf \it \bi} {} + {[Iwona-Regular]} + {\_def\_fontnamegen{[Iwona\_condV\_weightV-\_currV]:\_capsV\_fontfeatures}} + +\_wlog{\_detokenize{% +Modifiers:^^J + \caps ...... caps & small caps^^J + \cond ...... condensed variants^^J + \light ..... light (only \rm \it)^^J + \medium .... medium (only \rm \it)^^J + \bolder .... heavy (only \rm \it) +}} + +\_moddef \resetmod {\_fsetV caps={},cond={},weight={} \_fvars Regular Bold Italic BoldItalic } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } +\_moddef \nocaps {\_fsetV caps={} } +\_moddef \cond {\_fsetV cond=Cond } +\_moddef \light {\_fsetV weight=Light \_fvars Regular . Italic . } +\_moddef \medium {\_fsetV weight=Medium \_fvars Regular . Italic . } +\_moddef \bolder {\_fsetV weight=Heavy \_fvars Regular . Italic . } +\_moddef \nocond {\_fsetV cond={} } + +\_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-kurier.opm b/macros/optex/base/f-kurier.opm new file mode 100644 index 0000000000..ca1a6e381e --- /dev/null +++ b/macros/optex/base/f-kurier.opm @@ -0,0 +1,26 @@ +%% This is part of the OpTeX project, see http://petr.olsak.net/optex + +\_famdecl [Kurier] \Kurier {Two element sans serif typeface} + {\caps \cond \light \medium \bolder} {\rm \bf \it \bi} {} + {[Kurier-Regular]} + {\_def\_fontnamegen{[Kurier\_condV\_weightV-\_currV]:\_capsV\_fontfeatures}} + +\_wlog{\_detokenize{% +Modifiers:^^J + \caps ...... caps & small caps^^J + \cond ...... condensed variants^^J + \light ..... light (only \rm \it)^^J + \medium .... medium (only \rm \it)^^J + \bolder .... heavy (only \rm \it) +}} + +\_moddef \resetmod {\_fsetV caps={},cond={},weight={} \_fvars Regular Bold Italic BoldItalic } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } +\_moddef \nocaps {\_fsetV caps={} } +\_moddef \cond {\_fsetV cond=Cond } +\_moddef \light {\_fsetV weight=Light \_fvars Regular . Italic . } +\_moddef \medium {\_fsetV weight=Medium \_fvars Regular . Italic . } +\_moddef \bolder {\_fsetV weight=Heavy \_fvars Regular . Italic . } +\_moddef \nocond {\_fsetV cond={} } + +\_initfontfamily % new font family must be initialized diff --git a/macros/optex/base/f-lato.opm b/macros/optex/base/f-lato.opm new file mode 100644 index 0000000000..bedb33a8a2 --- /dev/null +++ b/macros/optex/base/f-lato.opm @@ -0,0 +1,34 @@ +%% This is part of the OpTeX project, see http://petr.olsak.net/optex + +\_famdecl [Lato] \Lato {Geometric grotesk, many weights} + {\hair \thin \light \normal \book \bolder} {} {} + {[Lato-Regular]} + {\_def\_fontnamegen {[Lato-\_currV]:\_capsV\_fontfeatures}} + +\_wlog{\_detokenize{% +Modifier: \caps .... Old digits only (caps not provided)^^J% +Modifiers (face weight):^^J + \hair ...... \rm, \it = Hair, \bf, \bi = Normal^^J + \thin ...... \rm, \it = Thin, \bf, \bi = Medium^^J + \light ..... \rm, \it = Light, \bf, \bi = Semibold^^J + \normal .... \rm, \it = Normal, \bf, \bi = Bold^^J + \book ...... \rm, \it = Medium, \bf, \bi = Heavy^^J + \bolder .... \rm, \it = Semibold, \bf, \bi = Black^^J% +}} + +\_moddef \resetmod {\_fsetV caps={} \_fvars Regular Bold Italic BoldItalic } +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } +\_moddef \hair {\_fvars Hairline Regular HairlineItalic Italic } +\_moddef \thin {\_fvars Thin Medium ThinItalic MediumItalic } +\_moddef \light {\_fvars Light Semibold LightItalic SemiboldItalic } +\_moddef \normal {\_fvars Regular Bold Italic BoldItalic } +\_moddef \book {\_fvars Medium Heavy MediumItalic HeavyItalic } +\_moddef \bolder {\_fvars Semibold Black SemiboldItalic BlackItalic } + +\_moddef \caps {\_fsetV caps=+smcp;\_ffonum; } +\_moddef \nocaps {\_fsetV caps={} } + +\_initfontfamily % new font family must be initialized + +\_endcode + diff --git a/macros/optex/base/fams-ini.opm b/macros/optex/base/fams-ini.opm index ad3ace24f3..505887f46e 100644 --- a/macros/optex/base/fams-ini.opm +++ b/macros/optex/base/fams-ini.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -% Version <2020-02-28>. Loaded in format and secondly on demand by \fontfam[catalog] +% Version <2022-10-18>. Loaded in format and secondly on demand by \fontfam[catalog] \_famtext {Special name for printing a catalog :} @@ -169,6 +169,23 @@ \caps, \caps\cond: {\rm\bf\it\bi} \caps\ttset: {\rm\bf} } +\_famfrom {Malgorzata Budyta, Janusz Marian Nowacki} +\_faminfo [Kurier] {Two element sans serif typeface} {f-kurier} + { -,\cond,\caps,\caps\cond: {\rm\it\bf\bi} + \light,\light\cond,\medium,\medium\cond,\bolder,\bolder\cond: {\rm\it} + } +\_faminfo [Iwona] {Sans serif typeface derived from Kurier} {f-iwona} + { -,\cond,\caps,\caps\cond: {\rm\it\bf\bi} + \light,\light\cond,\medium,\medium\cond,\bolder,\bolder\cond: {\rm\it} + } + +\_famfrom {tyPoland Lukasz Dziedzic} +\_faminfo [Lato] {Geometric grotesk, many weights} {f-lato} + { \hair: {\rm\it} \thin: {\rm\it} \light: {\rm\it} -: {\rm\it} + \book: {\rm\it} \bolder: {\rm\it} -: {\bf\bi} + \book: {\bf\bi} \bolder: {\bf\bi} + } + \_famfrom {Julieta Ulanovsky, http://www.zkysky.com.ar} \_faminfo [Montserrat] {Inspired from old posters in Montserat in Buenos Aires} {f-montserrat} { -,\caps,\alter: {\rm\bf\it\bi} \xlight,\elight,\light,-,\medium,\semibold: {\rm\it} diff --git a/macros/optex/base/fnotes.opm b/macros/optex/base/fnotes.opm index 661d54c33f..8f56ba1aea 100644 --- a/macros/optex/base/fnotes.opm +++ b/macros/optex/base/fnotes.opm @@ -132,8 +132,8 @@ as a box shifted down by `\parskip` and with `\vskip-\baselineskip` followed. \_cod ----------------------------- -\_def\_mnote #1#{\_ifx^#1^\_else \_mnoteC#1\_end \_fi \_mnoteD} -\_def\_mnoteC up#1\_end{\_mnoteskip=#1\_relax} % \mnote up {} syntax +\_def\_mnote #1#{\_ifx^#1^\_else \_mnoteC#1\_fin \_fi \_mnoteD} +\_def\_mnoteC up#1\_fin{\_mnoteskip=#1\_relax} % \mnote up {} syntax \_long\_def\_mnoteD#1{% \_ifvmode \_vskip\_parskip{\_mnoteA{#1}}\_nobreak\_vskip-\_baselineskip\_vskip-\_parskip \_else \_lower\_dp\_strutbox\_hbox{}\_vadjust{\_kern-\_dp\_strutbox \_mnoteA{#1}\_kern\_dp\_strutbox}% diff --git a/macros/optex/base/fonts-catalog.opm b/macros/optex/base/fonts-catalog.opm index cdd77359f1..347c94b145 100644 --- a/macros/optex/base/fonts-catalog.opm +++ b/macros/optex/base/fonts-catalog.opm @@ -47,7 +47,7 @@ } \_def\_dosamples #1:#2{\_ifx^#2^\_else \_def\_printvars{#2}% - \_ea\_dosamplesA\_romannumeral-`\.#1,,% + \_nospaceafter\_dosamplesA #1,,% \_ea\_dosamples\_fi } \_def\_dosamplesA#1,{% diff --git a/macros/optex/base/fonts-resize.opm b/macros/optex/base/fonts-resize.opm index e49303f377..34885d44bd 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 <2022-02-22>} % preloaded in format +\_codedecl \setfontsize {Font resizing macros <2022-11-08>} % preloaded in format \_doc ----------------------------- \`\initunifonts` macro extends \LuaTeX's font capabilities, @@ -10,19 +10,22 @@ from \LaTeX's `luatexbase` namespace, we provide our own replacements. \^`\initunifonts` sets itself to relax because we don't want to do this work twice. + \`\ufont` is a shortcut of \^`\initunifonts`~`\font`. \_cod ----------------------------- -\_def\_initunifonts {% +\_protected\_def \_initunifonts {% \_directlua{% require('luaotfload-main') luaotfload.main() - optex_hook_into_luaotfload() + optex.hook_into_luaotfload() }% \_glet \_fmodtt=\_unifmodtt % use \_ttunifont for \tt \_glet \_initunifonts=\_relax % we need not to do this work twice \_glet \initunifonts=\_relax } -\_public \initunifonts ; +\_protected\_def \_ufont {\_initunifonts \_font} + +\_public \initunifonts \ufont ; \_doc ----------------------------- The \`\setfontsize` `{}` saves the `` to the \`\_sizespec` macro. @@ -74,7 +77,8 @@ Note, that the `\_xfontname` output is converted due to optical size data using `\_optfn`. \_cod ----------------------------- -\_def\_fontlet#1#2{\_ifx #2=\_ea\_fontlet \_ea#1\_else \_font #1{\_optfn{\_xfontname#2}}\_fi} +\_protected\_def \_fontlet #1#2{\_ifx #2=\_ea\_fontlet \_ea#1\_else + \_ea\_font \_ea#1\_expanded{{\_optfn{\_xfontname#2}}}\_fi} \_public \xfontname \fontlet ; \_doc ----------------------------- @@ -83,17 +87,21 @@ It changes the current font at the given . \nl \`\resizethefont` is implemented by \^`\newcurrfontsize` using data from - the \^`\_sizespec` macro. + the \^`\_sizespec` macro.\nl + \`\sfont` has the same syntax like `\font` primitive, but declares a + macro which selects the font and sets its size properly dependent on the + current size. \_cod ----------------------------- -\_def \_newcurrfontsize #1{% \newcurrfontsize{at25pt} - \_ea\_def \_ea\_tmp \_ea{\_csname \_ea\_csstring \_the\_font \_endcsname}% - \_ea\_fontlet \_tmp \_font #1\_relax - \_ea\_fontloaded \_tmp - \_tmp +% \newcurrfontsize{at25pt} +\_def \_newcurrfontsize {\_ea\_newcurrfontsizeA \_csname \_ea\_csstring \_the\_font \_endcsname} +\_def \_newcurrfontsizeA #1#2{\_fontlet #1\_font #2\_relax \_fontloaded#1#1} +\_protected\_def \_resizethefont {\_newcurrfontsize\_sizespec} +\_protected\_def \_sfont #1{% + \_protected\_edef #1{\_csname _sfont:\_csstring#1\_endcsname \_resizethefont}% + \_initunifonts \_ea\_font \_csname _sfont:\_csstring#1\_endcsname } -\_protected\_def \_resizethefont{\_newcurrfontsize\_sizespec} -\_public \newcurrfontsize \resizethefont ; +\_public \newcurrfontsize \resizethefont \sfont ; \_doc ----------------------------- The \`\_regtfm` ` ` @@ -169,7 +177,8 @@ The can be empty or `at` or `scaled`. The \OpTeX/ starts with `\font` primitive which is able to read only `tfm` files. i.e.\ the `.tfm` (and additional data for glyphs) must be correctly installed in your system. If you want to load -OpenType `otf` or `ttf` font files, use the declarator \^`\initunifonts`. +OpenType `otf` or `ttf` font files, use the declarator \^`\initunifonts` +before first `\font` primitive. This command adds additional features to the `\font` primitive which gives the extended syntax: \begtt \catcode`\<=13 @@ -193,8 +202,9 @@ The original syntax for `tfm` files is also available. Example: primitive from `luaotfload` package. More information is available in the `luaotfload-latex.pdf` file. -Note, that \^`\fontfam` does (among other things) \^`\initunifonts` -internally. You need not to specify it if \^`\fontfam` is used. +You can use \^`\ufont` macro which runs \^`\initunifonts` followed by `\font` +primitive. And \^`\fontfam` does (among other things) \^`\initunifonts` +too. You need not to specify \^`\initunifonts` if \^`\fontfam` or \^`\ufont` is used. It seems that you must decide about final size of the font before it is loaded by the `\font` primitive. It is not exactly true; \OpTeX/ offers @@ -245,8 +255,7 @@ The \^`\resizethefont` works with arbitrary current font, for example with the font loaded directly by `\font` primitive. For example: \begtt -\initunifonts -\font\tencrimson=[Crimson-Roman]:+onum % font Crimson-Regular at 10 pt is loaded +\ufont\tencrimson=[Crimson-Roman]:+onum % font Crimson-Regular at 10 pt is loaded \def\crimson{\tencrimson\resizethefont} % \crimson uses the font size on demand \crimson The 10 pt text is here. @@ -258,6 +267,26 @@ behaves like variant selector in the Font Selection System (section~\ref[fontsys It takes only information about size from the font context, but it is sufficient. You can use it in titles, footnotes, etc. The font size depending on surrounding size is automatically selected. +There is a shortcut \^`\sfont` with the same syntax like `\font` primitive, +it declares a macro which selects the font and does resizing depending on +the current size. So, the example above can be realized by +`\sfont\crimson=[Crimson-Roman]:+onum`. + +\secc The `\font`-like commands summary + +\begitems +* `\font` is \TeX/ primitive. When \OpTeX/ starts, then it accepts only + classical \TeX/ syntax and doesn't allow to load Unicode fonts. + Once \^`\initunifonts` (or \^`\fontfam`) is used, the `\font` primitive is + re-initialized: now it accepts extended syntax and it is able to load Unicode + OpenType fonts. +* \^`\ufont` is a shortcut of `\initunifonts \font`. I.e.\ it behaves like + `\font` and accepts extended syntax immediatelly. +* \^`\sfont` has syntax like extended `\font`. It declares a macro which + selects the given font and resizes it to the current size (given by + \^`\setfontsize`). In various part of document (text, footnotes, titles), the + size of this font is selected by the declared macro properly. +\enditems \secc[fontlet] The \code{\\fontlet} declarator @@ -288,13 +317,13 @@ able to choose right file if various optical sizes and corresponding file names are declared for the font by \^`\_regtfm` or \^`\_regoptsizes` command. The command \^`\setfontsize` sets the internal reuirements for optical size if the parameter is in the format `at` or `mag`. -Then the command \^`\resizethefont` or variant selectors try to choose +Then the command \^`\resizethefont` or \^`\fontlet` or variant selectors try to choose the font suitable for the required optical size. For example \begtt \fontfam[lm] The text is printed in font [lmroman10-regular] at 10 pt. \setfontsize{at13pt}\rm - Now in the text is printed in [lmroman12-regular] at 13 pt. + Now, the text is printed in [lmroman12-regular] at 13 pt. \endtt See also section~\ref[optsizes]. @@ -322,6 +351,9 @@ Luaotfload documentation for more information. \_endinput +2022-11-08 \sfont introduced, \protected: \initunifont, \ufont, \fontlet +2022-11-07 \fontlet \a\a: bug fixed +2022-10-14 \ufont introduced 2022-02-22 Font Selection System reimplemented, \fontsel introduced 2021-05-02 better concept of doc, moving parts to fonts-select 2021-04-17 \_fontloaded, \_newfontloaded introduced diff --git a/macros/optex/base/fonts-select.opm b/macros/optex/base/fonts-select.opm index 33d331150b..7e00c9baea 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 <2022-02-22>} % preloaded in format +\_codedecl \fontfam {Fonts selection system <2022-12-01>} % preloaded in format \_doc ----------------------------- The main principle of the Font Selection System is: run one or more @@ -161,7 +161,7 @@ runs only if the `\_V` is defined as `` or `` or ... or ``. \nl - \`\_prepcommalist` `ab,{},cd,\_end,` expands to `ab,,cd,` (auxiliary macro + \`\_prepcommalist` `ab,{},cd,\_fin,` expands to `ab,,cd,` (auxiliary macro 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 @@ -184,10 +184,10 @@ \_ifx,#1\_else\_sdef{_#1V}{#2}\_ea\_ea\_ea\_fsetVa\_fi\_fi } \_def \_onlyif #1=#2:#3{% - \_edef\_act{\_noexpand\_isinlist{,\_prepcommalist #2,\_end,}{,\_cs{_#1V},}}\_act + \_edef\_act{\_noexpand\_isinlist{,\_prepcommalist #2,\_fin,}{,\_cs{_#1V},}}\_act \_iftrue #3\_fi } -\_def\_prepcommalist#1,{\_ifx\_end#1\_empty\_else #1,\_ea\_prepcommalist\_fi} +\_def\_prepcommalist#1,{\_ifx\_fin#1\_empty\_else #1,\_ea\_prepcommalist\_fi} \_def\_ffonum {+onum;+pnum} \_doc ----------------------------- @@ -258,7 +258,7 @@ They have precedence when \^`\fontsel` constructs the name. \_cod ----------------------------- -\_def\_fontdef #1#2{\_begingroup +\_protected\_def \_fontdef #1#2{\_begingroup \_edef\_xfamv{\_csstring#1}\_let\_ttfamv\_xfamv #2% \_ea\_endgroup\_ea \_let\_ea #1\_the\_font } @@ -278,7 +278,7 @@ the same meaning. \_cod ----------------------------- -\_def\_famvardef#1#2{% +\_protected\_def \_famvardef #1#2{% \_sdef{_f:\_currfamily:\_csstring#1}% {{\_edef\_xfamv{\_csstring#1}\_let\_ttfamv\_xfamv #2\_ea}\_the\_font \_def\_currvar{#1}}% \_protected\_edef\_tmpa {% @@ -307,7 +307,7 @@ terminal and to the log file. \_cod ----------------------------- -\_def\_fontfam[#1]{% +\_protected\_def \_fontfam [#1]{% \_lowercase{\_edef\_famname{\_ea\_removespaces #1 {} }}% \_isfile {f-\_famname.opm}\_iftrue \_opinput {f-\_famname.opm}% \_else @@ -349,8 +349,9 @@ \`\_famtext` does nothing or prints the text on the terminal. \nl \`\_faminfo` `[] {} {} {}` - does\nl `\_def \_famf: {}` or prints information on - the terminal. + does\nl `\_def \_famf: {}` (only if differs + from `f-`) or prints information on the terminal. The + data are used when printing the font catalog. \nl \`\_famalias` `[]` does `\def \_famf: {}` where `` is stored from the previous `\_faminfo` command. Or @@ -364,8 +365,8 @@ \_def\_famtext #1{} \_def\_faminfo [#1]#2#3#4{% \_lowercase{\_edef\_tmp{\_ea\_removespaces #1 {} }}% - \_sdef{_famf:\_tmp}{#3}% - \_def\_famfile{#3}% + \_edef\_tmpa{f-\_tmp}\_def\_famfile{#3}% + \_unless\_ifx\_tmpa\_famfile \_sdef{_famf:\_tmp}{#3}\_fi } \_def\_famalias [#1]{% \_lowercase{\_edef\_tmpa{\_ea\_removespaces #1 {} }}% @@ -898,6 +899,8 @@ with Unicode fonts loaded by \^`\fontfam`. \endinput +2022-12-01 \faminfo saves f- to the format only when needed +2022-11-08 \protected: \fontdef, \famvardef, \fontfam 2022-02-22 Font Selection System reimplemented, \fontsel introduced 2021-09-24 \_unichars used in \initunifonts 2021-07-16 \initunifonts: optex_hook_into_luaotfload added. diff --git a/macros/optex/base/graphics.opm b/macros/optex/base/graphics.opm index b54b52c926..77e78cef23 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 <2022-03-05>} % preloaded in format +\_codedecl \inspic {Graphics <2022-11-05>} % preloaded in format \_doc ----------------------------- \`\inspic` accepts old syntax `\inspic ` @@ -47,8 +47,8 @@ \_newtoks\_inkdefs \_inkdefs={% \_def\makeatletter#1\makeatother{}% - \_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\includegraphics[#1]#2{\_inkscanpage#1,page=,\_fin \_inspic{\_the\_tmptoks}\_hss}% + \_def\_inkscanpage#1page=#2,#3\_fin{\_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}}% \_def\begin#1{\_csname _begin#1\_endcsname}% @@ -169,7 +169,7 @@ } \_def\_puttext{\_ea\_ea\_ea\_puttextA\_scantwodimens} -\_def\_puttextA#1#2#3{{\_setbox0=\_hbox{{#3}}\_dimen1=#1sp \_dimen2=#2sp \_puttextB}} +\_long\_def\_puttextA#1#2#3{{\_setbox0=\_hbox{{#3}}\_dimen1=#1sp \_dimen2=#2sp \_puttextB}} \_def\_puttextB{% \_ifvmode \_ifdim\_prevdepth>\_zo \_vskip-\_prevdepth \_relax \_fi @@ -383,7 +383,7 @@ \_ea \_shadowlayer \_fi }% \_pdfliteral{q /op1 gs 0 g 1 0 0 1 \_shadowmoveto\_space cm - \_ifx#1\_circlet 1 0 0 1 \_expr{\_bp{.5\_wd0}} \_expr{\_bp{(\_ht0-\_dp0)/2}} cm + \_ifx#1\_circlet 1 0 0 1 \_bp{.5\_wd0} \_bp{(\_ht0-\_dp0)/2} cm \_else 1 0 0 1 -\_shadowb\_space -\_shadowb\_space cm \_fi \_shadowlayer Q} }} @@ -447,6 +447,8 @@ the \^`\transformbox{}{\copy\mypic}`. \_endinput +2022-11-05 \_doshadow: renduntant \_expr from \_expr{\_bp{...}} removed +2022-10-18 \_puttextA defined \long, bug fixed 2022-03-05: \_addextgstate, \pageresources, \addpageresources added 2022-03-03: \_coc introduced 2021-07-16: \inoval, \incircle are more simple, using attribitecolor features diff --git a/macros/optex/base/hi-syntax.opm b/macros/optex/base/hi-syntax.opm index 586cfed69e..c708be0563 100644 --- a/macros/optex/base/hi-syntax.opm +++ b/macros/optex/base/hi-syntax.opm @@ -23,15 +23,15 @@ \_def\_replfromto #1#2{\_edef\_tmpa{{#1}{#2}}\_ea\_replfromtoE\_tmpa} \_def\_replfromtoE#1#2#3{% #1=from #2=to #3=replacement \_def\_replfrom##1#1##2{\_addto\_tmpb{##1}% - \_ifx\_end##2\_ea\_replstop \_else \_afterfi{\_replto##2}\_fi}% + \_ifx\_fin##2\_ea\_replstop \_else \_afterfi{\_replto##2}\_fi}% \_def\_replto##1#2##2{% - \_ifx\_end##2\_afterfi{\_replfin##1}\_else + \_ifx\_fin##2\_afterfi{\_replfin##1}\_else \_addto\_tmpb{#3}% \_afterfi{\_replfrom##2}\_fi}% - \_def\_replfin##1#1\_end{\_addto\_tmpb{#3}\_replstop}% - \_edef\_tmpb{\_ea}\_ea\_replfrom\_tmpb#1\_end#2\_end\_end\_relax + \_def\_replfin##1#1\_fin{\_addto\_tmpb{#3}\_replstop}% + \_edef\_tmpb{\_ea}\_ea\_replfrom\_tmpb#1\_fin#2\_fin\_fin\_relax } -\_def\_replstop#1\_end\_relax{} +\_def\_replstop#1\_fin\_relax{} \_def\_finrepl{} \_doc ----------------------------- @@ -55,12 +55,12 @@ The \`\_xscan` macro replaces occurrences of `\x` by `\z` in the post-processing phase. The construct `\x {}` expands to `\_xscan {}^^J^`. - If `#3` is `\_end` then it signals that something wrong happens, the + If `#3` is `\_fin` then it signals that something wrong happens, the `` was not terminated by legal `` when `\replfromto` did work. We must to fix this by using the \`\_xscanR` macro. \_cod ----------------------------- -\_def\_xscan#1#2^^J#3{\_ifx\_end#3 \_ea\_xscanR\_fi +\_def\_xscan#1#2^^J#3{\_ifx\_fin#3 \_ea\_xscanR\_fi \z{#1}{#2}% \_ifx^#3\_else ^^J\_afterfi{\_xscan{#1}#3}\_fi} \_def\_xscanR#1\_fi#2^{^^J} @@ -86,8 +86,8 @@ \_def\_hisyntax#1{\_def\_prepareverbdata##1##2{% \_let\n=\_relax \_let\b=\_relax \_def\t{\n\_noexpand\t\n}\_let\_start=\_relax - \_adef{ }{\n\_noexpand\ \n}\_edef\_tmpb{\_start^^J##2\_end}% - \_replthis{^^J}{\n^^J\b\n}\_replthis{\b\n\_end}{\_end}% + \_adef{ }{\n\_noexpand\ \n}\_edef\_tmpb{\_start^^J##2\_fin}% + \_replthis{^^J}{\n^^J\b\n}\_replthis{\b\n\_fin}{\_fin}% \_let\x=\_relax \_let\y=\_relax \_let\z=\_relax \_let\t=\_relax \_hicomments % keeps comments declared by \commentchars \_endlinechar=`\^^M @@ -104,7 +104,7 @@ \_the\_hicolors % colors which have precedece \_else\_opwarning{Syntax "\_tmpa" undeclared (no file hisyntax-\_tmpa.opm)} \_fi\_fi - \_replthis{\_start\n^^J}{}\_replthis{^^J\_end}{^^J}% + \_replthis{\_start\n^^J}{}\_replthis{^^J\_fin}{^^J}% \_def\n{}\_def\b{}\_adef{ }{\_dsp}% \_bgroup \_lccode`\~=`\ \_lowercase{\_egroup\_def\ {\_noexpand~}}% \_def\w####1{####1}\_def\x####1####2{\_xscan{####1}####2^^J^}% diff --git a/macros/optex/base/hyperlinks.opm b/macros/optex/base/hyperlinks.opm index 4c2007cddb..7505436f16 100644 --- a/macros/optex/base/hyperlinks.opm +++ b/macros/optex/base/hyperlinks.opm @@ -136,10 +136,10 @@ \_replstring\_tmpb{[||]}{{gb|}}% \_replstring\_tmpb{ }{{ }}% \_replstring\_tmpb{://}{{://}}% - \_ea\_ulink \_ea[\_ea{\_tmpa}] {\_urlfont \_ea\_urlA\_tmpb\_end}% + \_ea\_ulink \_ea[\_ea{\_tmpa}] {\_urlfont \_ea\_urlA\_tmpb\_fin}% }} -\_def\_urlA#1{\_ifx\_end#1\_else \_urlC{}{#1}\_fi} -\_def\_urlB#1{\_ifx\_end#1\_else \_urlC{\_urlxskip}{#1}\_fi} +\_def\_urlA#1{\_ifx\_fin#1\_else \_urlC{}{#1}\_fi} +\_def\_urlB#1{\_ifx\_fin#1\_else \_urlC{\_urlxskip}{#1}\_fi} \_def\_urlC#1#2{% \_ifcsname _ur:#2\_endcsname \_lastnamedcs \_ea\_ea\_ea \_urlA \_else #1#2\_ea\_ea\_ea \_urlB \_fi diff --git a/macros/optex/base/if-macros.opm b/macros/optex/base/if-macros.opm index 8f6082a27a..9113b5f8be 100644 --- a/macros/optex/base/if-macros.opm +++ b/macros/optex/base/if-macros.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \newif {Special if-macros, is-macros and loops <2022-05-04>} % preloaded in format +\_codedecl \newif {Special if-macros, is-macros and loops <2022-12-02>} % preloaded in format \_doc ---------------------------- \secc Classical \code{\\newif} @@ -32,9 +32,12 @@ \_doc ---------------------------- \`\afterfi` `{}\fi` closes condition by `\fi` and processes . Usage: - \begtt - \if \afterfi{} \else \afterfi{} \fi + \begtt \catcode`<=13 + \if \afterfi{} \else \afterfi{} \fi \endtt + Nested `\if..\afterfi{\if..\afterfi{...}\fi}\fi` are possible. Another approach is mentioned + in \ulink[http://petr.olsak.net/optex/optex-tricks.html\#fiinif]{OpTeX trick 0098} + which also solves the `\fi` in `\if` problem. \_cod ---------------------------- \_long\_def \_afterfi#1#2\_fi{\_fi#1} @@ -302,9 +305,63 @@ \_public \isnextchar ; + \_doc ---------------------------- + \`\casesof` ` ` implements something similar to + the `switch` command known from C language. It is expandable macro. The + is a list of arbitrary number of pairs in the format + ``\,`{}` which must be finalized by the pair + `\_finc {}`. The optional spaces after s + and between listed cases are ignored. The usage of \^`\casesof` looks like: + \begtt \catcode`<=13 + \casesof + {} + {} + ... + {} + \_finc {} + \endtt + The meaning of tokens are compared by `\ifx` primitive. + The parts `` can be finalized by a macro which can read more + data from the input stream as its parameters. + \_cod ---------------------------- + +\_long\_def \_casesof #1#2#3{\_ifx #2\_finc \_ea\_ignoresecond \_else \_ea\_usesecond \_fi + {#3}{\_ifx#1#2\_ea\_ignoresecond \_else \_ea\_usesecond \_fi {\_finc{#3}}{\_casesof#1}}% +} +\_long\_def \_finc #1#2\_finc#3{#1} + +\_public \casesof ; + + \_doc ----------------------------- + \`\xcasesof` `` extends the features of the macro \^`\casesof`. + Each pair from the `` is in the format + `{}{}`, only the last pair must have the different + format: `\_finc {}`. The `` can be arbitrary + primitive `\if*` condition (optionally prefixed by `\unless`) and it must be closed + in its expansion. It means that `{\ifnum\mycount>0}` is bad, `{\ifnum\mycount>0 }` + is correct. Optional spaces between parameters are ignored. Example: + \begtt + \message {The \tmpnum has \xcasesof + {\ifnum\tmpnum>0 } {positive} + {\ifnum\tmpnum=0 } {equal to zero} + \_finc {negative} value} + \endtt + The \^`\xcasesof` macro works with principle: first true condition wins, + next conditions are not evaluated. + \_cod ----------------------------- + +\_long\_def \_xcasesof #1{\_xcasesofA #1\_finc} +\_long\_def \_xcasesofA #1#2\_finc #3{% + \_ifx #1\_finc \_ea\_ignoresecond\_else \_ea\_usesecond\_fi + {#3}{#1#2\_ea\_ignoresecond\_else \_ea\_usesecond\_fi {\_finc{#3}}{\_xcasesof}}% +} +\_public \xcasesof ; \_endcode +2022-12-02 \xcasesof: its first parameter is \long too. +2022-11-29 renamed to \casesof, \xcasesof. +2022-11-26 \casesby, \casesbyif introduced. 2022-05-04 \isinlist created expandable. 2022-03-30 \afterfi defined as \long. 2021-08-02 more robust \fornum: \fi moved by \afterfi diff --git a/macros/optex/base/lang-data.opm b/macros/optex/base/lang-data.opm index 6e11f8bd9a..e1b68e5dde 100644 --- a/macros/optex/base/lang-data.opm +++ b/macros/optex/base/lang-data.opm @@ -1,10 +1,10 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \_langdata {Language dependent data <2022-06-28>} % only en, cs preloaded in format +\_codedecl \_langdata {Language dependent data <2022-10-11>} % only en, cs preloaded in format \_langdata en {English} % ----------------------------------------------- \_langw en Chapter Table Figure Subject -\_langb en {, and } { et al.} { ed.} {cit.~} {Vol.~} {No.~} {pp.~} {~p.} {,~ed.} {,~eds.} +\_langb en {, and } { et al.} {\,ed.} {cit.~} {Vol.~} {No.~} {pp.~} {~p.} {,~ed.} {,~eds.} {Available from } {Available also from } {Bachelor's Thesis} {Master's Thesis} {Ph.D. Thesis} \_monthw en January February March April May June @@ -19,10 +19,10 @@ \_langdata cs {Czech} % ------------------------------------------------ % Chapter Table Figure Subject \_langw cs Kapitola Tabulka Obrázek Věc -% {, and } { et al.} { ed.} {cit.~} {Vol.~} {No.~} {pp.~} {~p.} {,~ed.} {,~eds.} +% {, and } { et al.} {\,ed.} {cit.~} {Vol.~} {No.~} {pp.~} {~p.} {,~ed.} {,~eds.} % {Available from } {Available also from } % {Bachelor's Thesis} {Master's Thesis} {Ph.D. Thesis} -\_langb cs { a } { a~kol.} { vyd.} {vid.~} {ročník~} {č.~} {s.~} {~s.} {,~editor} {,~editoři} +\_langb cs { a } { a~kol.} {\,vyd.} {vid.~} {ročník~} {č.~} {s.~} {~s.} {,~editor} {,~editoři} {Dostupné na } {Dostupné též na } {Bakalářská práce} {Diplomová práce} {Disertační práce} % January February March April May June @@ -31,6 +31,8 @@ července srpna září října listopadu prosince \_sdef{_mt:today:cs}{\_the\_day.~\_mtext{m\_the\_month} \_the\_year} % date format \_quotationmarks cs {„“‚‘} +\_preplangmore cs {\_frenchspacing \_postexhyphenchar=`\- + \_def\_langreset{\_postexhyphenchar=0 }} \_let \_sortingdatacs = \_sortingdatalatin \_let \_ignoredcharscs = \_ignoredcharsgeneric @@ -101,7 +103,12 @@ \_langw hu Fejezet Táblázat Ábra Téma \_quotationmarks hu {„”»«} %todo -\_let \_sortingdatahu = \_sortingdatalatin +\_def \_sortingdatahu {% + /,{ },-,&,@,% + aAáÁ,bB,cC,dD,eEéÉ,fF,gG,hH,iIíÍ,jJ,kK,lL,mM,nN,oOóÓ,öÖőŐ,% + pP,qQ,rR,sS,tT,uUúÚ,üÜűŰ,vV,wW,xX,yY,zZ,^^Z,% + 0,1,2,3,4,5,6,7,8,9,'% +} \_let \_ignoredcharshu = \_ignoredcharsgeneric \_def \_compoundcharshu {cs:c^^Z Cs:C^^Z CS:C^^Z dzz:d^^Z^^Z Dzz:D^^Z^^Z DZZ:D^^Z^^Z dz:d^^Z Dz:D^^Z DZ:D^^Z @@ -128,13 +135,15 @@ \_langdata sk {Slovak} % ------------------------------------------------ \_langw sk Kapitola Tabuľka Obrázok Vec -\_langb sk { a } { a~kol.} { vyd.} {vid.~} {ročník~} {č.~} {s.~} {~s.} {,~editor} {,~editori} +\_langb sk { a } { a~kol.} {\,vyd.} {vid.~} {ročník~} {č.~} {s.~} {~s.} {,~editor} {,~editori} {Dostupné na } {Dostupné tiež na } {Bakalárska práca} {Diplomová práca} {Dizertačná práca} \_monthw sk januára februára marca apríla mája júna júla augusta septembra októbra novembra decembra \_sdef{_mt:today:sk}{\_the\_day.~\_mtext{m\_the\_month} \_the\_year} % date format \_quotationmarks sk {„“‚‘} +\_preplangmore sk {\_frenchspacing \_postexhyphenchar=`\- + \_def\_langreset{\_postexhyphenchar=0 }} \_let \_sortingdatask = \_sortingdatalatin \_let \_ignoredcharssk = \_ignoredcharsgeneric @@ -150,6 +159,9 @@ \_endcode +2022-10-11: \postexhyphenchar setting added to cs and sk languages +2022-10-10: { ed.} changed to {\,ed.} +2022-08-31: \_sortingdatahu corrected 2022-06-28: Spanish, Polish, French, Swedish, Hungarian sorting rules added 2022-06-28: German sorting rules added 2022-02-19: concept finalized, but data still far of completness diff --git a/macros/optex/base/lang-decl.opm b/macros/optex/base/lang-decl.opm index 3b9f9e727d..d6b562ed45 100644 --- a/macros/optex/base/lang-decl.opm +++ b/macros/optex/base/lang-decl.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \langlist {Languages declaration <2022-02-19>} % preloaded in format +\_codedecl \langlist {Languages declaration <2022-10-11>} % preloaded in format \_doc ----------------------------- \`\_preplang` ` ` @@ -163,12 +163,21 @@ \_cod ----------------------------- \_def\_preplangmore #1 #2{\_ea \_gdef \_csname _langspecific:#1\_endcsname{#2}} -\_def\_langdefault{\_frenchspacing} \_preplangmore en {\_nonfrenchspacing} \_preplangmore enus {\_nonfrenchspacing} \_def\_langdefault {\_frenchspacing} + \_doc ----------------------------- + The \`\_langreset` is processed before macros declared by \^`\_preplangmore` + or before \^`\_langdefault`. If you set something for + your language by \^`\_preplangmore` then use `\def\_langreset{}` + in this code too in order to return default values for all other languages. + See `cs` part of `lang-data.opm` file for an example. + \_cod ----------------------------- + +\_def\_langreset {} + \_doc ----------------------------- The default `\language=0` is US-English with original hyphenation patterns preloaded in the format (see the end of section~\ref[plain]). @@ -236,7 +245,7 @@ \_cod ----------------------------- \_def\_uselang#1#2#3#4{\_language=#2\_lefthyphenmin=#3\_righthyphenmin=#4\_relax - \_trycs{_langspecific:#1}{\_langdefault}% + \_langreset \_def\_langreset{}\_trycs{_langspecific:#1}{\_langdefault}% } \_doc ----------------------------- @@ -310,5 +319,6 @@ \_endcode +2022-10-11 \_langreset introduced 2022-02-19 \_langinput moved here 2022-02-17 released, original file was hyphen-lan.opm diff --git a/macros/optex/base/languages.opm b/macros/optex/base/languages.opm index 4ae66ef1f4..1d7558444c 100644 --- a/macros/optex/base/languages.opm +++ b/macros/optex/base/languages.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \_mtext {Languages <2022-02-19>} % preloaded in format +\_codedecl \_mtext {Languages <2022-11-18>} % preloaded in format \_doc ----------------------------- Four words are generated by \OpTeX/ macros: \"Chapter", @@ -120,8 +120,8 @@ \_def\_qqA#1#2#3{\_bgroup\_setverb \_catcode`\ =10 \_isnextchar\_bgroup{\_catcode`\{=1 \_catcode`\}=2 #1#2#3}{#1#2#3}} -\_long\_def\_qqB#1#2#3"{\_egroup#1\_scantextokens{#3}#2} -\_long\_def\_qqC#1#2#3'{\_egroup#1\_scantextokens{#3}#2} +\_def\_qqB#1#2#3"{\_egroup#1\_scantextokens{#3}#2} +\_def\_qqC#1#2#3'{\_egroup#1\_scantextokens{#3}#2} \_def\_regquotes#1#2#3#4{\_bgroup \_lccode`~=`#2\_lowercase{\_egroup \_def#1##1~}{#3##1#4}} \_doc ----------------------------- @@ -139,6 +139,7 @@ \_endcode % ------------------------------------- +2022-11-18 \"..." are not \long now 2022-02-19 \quotes, \_quotationmarks introduced 2022-02-04 \_langinput, words-lan.opm introduced 2021-05-23 \_monthw: bug fix diff --git a/macros/optex/base/makeindex.opm b/macros/optex/base/makeindex.opm index ba50352559..36b4a48c08 100644 --- a/macros/optex/base/makeindex.opm +++ b/macros/optex/base/makeindex.opm @@ -285,7 +285,7 @@ \_addto\_iilist{#1#2,}% % dvojice skupin vyresena \_sortreturn{\_fif\_mergesort}% % \mergesort dalsi \_fi - \_ifx\_end#3% % neco,konec (#1#2=neco) + \_ifx\_fin#3% % neco,konec (#1#2=neco) \_ifx\_empty\_iilist % neco=kompletni setrideny seznam \_def\_iilist{#1#2}% \_sortreturn{\_fif\_fif\_gobbletoend}% % koncim @@ -303,7 +303,7 @@ \_relax % zarazka, na ktere se zastavi \sortreturn } \_def\_sortreturn#1#2\_fi\_relax{#1} \_def\_fif{\_fi} -\_def\_gobbletoend #1\_end{} +\_def\_gobbletoend #1\_fin{} \_doc ----------------------------- The \`\_dosorting` `\list` macro redefines `\list` as sorted `\list`. @@ -342,7 +342,7 @@ \_csname _secondpass\_sortinglang \_endcsname % activates \_reversewords if needed \_def \_act##1{\_addto #1{##1,}}% \_edef #1{\_ea}\_ea\_xargs \_ea\_act #1;% commas between items added, mergesort initialized - \_edef \_iilist{\_ea}\_ea\_mergesort #1\_end,\_end + \_edef \_iilist{\_ea}\_ea\_mergesort #1\_fin,\_fin \_ea\_endgroup \_ea\_def\_ea#1\_ea{\_iilist}% } diff --git a/macros/optex/base/math-preload.opm b/macros/optex/base/math-preload.opm index 9f73ef24d1..a3ac3e44b3 100644 --- a/macros/optex/base/math-preload.opm +++ b/macros/optex/base/math-preload.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \normalmath {Math fonts CM + AMS preloaded <2022-07-22>} % preloaded in format +\_codedecl \normalmath {Math fonts CM + AMS preloaded <2022-12-01>} % preloaded in format \_doc ------------------------------ We have two math macros \`\normalmath` for the normal shape of all math @@ -126,47 +126,49 @@ like `\_loadmathfamily` does it. But the second parameter is a `\` declared previously by the `\font` primitive. \nl + The `` is saved by \^`\_loadmathfamily`, \^`\_setmathfamily` + to the \`\_mfam`. + \nl The font family is loaded at \`\_sizemtext`, \`\_sizemscript` and \`\_sizemsscript` sizes. These sizes are set by the \`\setmathsizes` `[//]` macro. These parameters are given in the \`\ptmunit` unit, it is set to 1\`\ptunit` and it is set to 1\,pt by default. \nl - \`\_corrmsize` `` can be used just before - `\_loadmathfamily` or `\_setmathfamily`. - The `` is decimal number, it denotes - scale-factor \"size of loaded math font in `\textstyle` : size of text font". - You can use it in `\_normalmath` or `\_boldmath` macros if you want to do a - corrections (for example due to different ex-height in text and math - font). The `\_corrmsize` is applied only to one following - `\_loadmathfamily` or `\_setmathfamily`. If it is missing - then the `` is 1 for such math family (i.e.\ no size corrections). + \`\_mfactor` sets scaling factor for given math fonts family + related to text font size. It does the setting `\_ptmunit=\_ptunit` where + the is defined by `\sdef{_mfactor:}{}`. + For eample, you can set `\sdef{_mfactor:1}{0.95}` if you found that + this scaling of math family 1 gives better visual compatibility + with used text fonts. If not declared then scaling factor is~1. \_cod ----------------------------- -\_def\_corrmsize#1 {\_ptmunit=#1\_ptunit} % for corrections of sizes in diferent fonts - -\_def\_loadmathfamily #1 #2 {% +\_def\_loadmathfamily {\_afterassignment\_loadmathfamilyA \_chardef\_mfam} +\_def\_loadmathfamilyA #1 {\_mfactor \_edef\_optsizesave{\_the\_optsize}% - \_optsize=\_sizemtext \_font\_mF=\_optfn{#2} at\_optsize \_textfont#1=\_mF - \_optsize=\_sizemscript \_font\_mF=\_optfn{#2} at\_optsize \_scriptfont#1=\_mF - \_optsize=\_sizemsscript \_font\_mF=\_optfn{#2} at\_optsize \_scriptscriptfont#1=\_mF - \_optsize=\_optsizesave \_ptmunit=\_ptunit + \_optsize=\_sizemtext \_font\_mF \_optfn{#1} at\_optsize \_textfont\_mfam=\_mF + \_optsize=\_sizemscript \_font\_mF \_optfn{#1} at\_optsize \_scriptfont\_mfam=\_mF + \_optsize=\_sizemsscript \_font\_mF \_optfn{#1} at\_optsize \_scriptscriptfont\_mfam=\_mF + \_optsize=\_optsizesave } -\_def\_setmathfamily #1 #2{\_let\_mF=#2% +\_def\_setmathfamily {\_afterassignment\_setmathfamilyA \_chardef\_mfam} +\_def\_setmathfamilyA #1{\_mfactor \_let\_mF=#1% \_edef\_optsizesave{\_the\_optsize}% - \_optsize=\_sizemtext \_fontlet#2=#2 at\_optsize \_textfont#1=#2% - \_optsize=\_sizemscript \_fontlet#2=#2 at\_optsize \_scriptfont#1=#2% - \_optsize=\_sizemsscript \_fontlet#2=#2 at\_optsize \_scriptscriptfont#1=#2% - \_optsize=\_optsizesave \_ptmunit=\_ptunit \_let#2=\_mF + \_optsize=\_sizemtext \_fontlet#1#1at\_optsize \_textfont\_mfam=#1% + \_optsize=\_sizemscript \_fontlet#1#1at\_optsize \_scriptfont\_mfam=#1% + \_optsize=\_sizemsscript \_fontlet#1#1at\_optsize \_scriptscriptfont\_mfam=#1% + \_optsize=\_optsizesave \_let#1=\_mF } \_def\_setmathsizes[#1/#2/#3]{\_ptmunit=\_ptunit \_def\_sizemtext{#1\_ptmunit}\_def\_sizemscript{#2\_ptmunit}% \_def\_sizemsscript{#3\_ptmunit}% } +\_def\_mfactor{\_ptmunit=\_trycs{_mfactor:\_the\_mfam}{}\_ptunit} + \_newdimen\_ptunit \_ptunit=1pt \_newdimen\_ptmunit \_ptmunit=1\_ptunit -\_public \setmathsizes \ptunit \ptmunit ; +\_public \setmathsizes \ptunit ; \_doc ----------------------------- \`\_setmathparam`` {}` sets @@ -176,10 +178,14 @@ \_cod ----------------------------- \_def\_setmathparam#1#2{% - #1\_displaystyle =#2\_fontdimen6\_textfont1 - #1\_textstyle =#2\_fontdimen6\_textfont1 - #1\_scriptstyle =#2\_fontdimen6\_scriptfont1 - #1\_scriptscriptstyle =#2\_fontdimen6\_scriptscriptfont1 + #1\_displaystyle =#2\_fontdimen6\_textfont1 + #1\_crampeddisplaystyle =#2\_fontdimen6\_textfont1 + #1\_textstyle =#2\_fontdimen6\_textfont1 + #1\_crampedtextstyle =#2\_fontdimen6\_textfont1 + #1\_scriptstyle =#2\_fontdimen6\_scriptfont1 + #1\_crampedscriptstyle =#2\_fontdimen6\_scriptfont1 + #1\_scriptscriptstyle =#2\_fontdimen6\_scriptscriptfont1 + #1\_crampedscriptscriptstyle =#2\_fontdimen6\_scriptscriptfont1 } \_doc ----------------------------- @@ -243,6 +249,9 @@ For example \_endinput +2022-12-01 reading number by \_loadmathfamily, \_setmathfamily more robust +2022-11-16: \_corrmsize removed, \_mfactor introduced +2022-09-04: \crampedstyles setings added. 2022-07-22: \_setmathparam\_Umathspaceafterscript added. 2022-02-22: \rm, \it, etc moved to fonts-select, \_marm, \_mait etc. introduced 2020-05-06: \itfam, \ttfam removed, (Unicode math preferred) diff --git a/macros/optex/base/math-unicode.opm b/macros/optex/base/math-unicode.opm deleted file mode 100644 index 22db1d095e..0000000000 --- a/macros/optex/base/math-unicode.opm +++ /dev/null @@ -1,343 +0,0 @@ -%% This is part of the OpTeX project, see http://petr.olsak.net/optex - -\_codedecl \loadmath {Unicode Math fonts <2022-07-22>} % preloaded in format - - \_doc ----------------------------- - \`\loadmath` `{}` loads the given font. It does: - \begitems - * define \`\_unimathfont` as ``, - * redefine `\normalmath` and `\boldmath` macros to their Unicode counterparts, - * load the `\_unimathfont` by `\normalmath`, - * print information about the loaded font on the terminal, - * redefine all encoding dependent setting by `\input unimath-codes.opm`, - * protect new loading by setting \`\_ifmathloading` to false. - \enditems - \`\noloadmath` disallows Unicode-math loading by \`\_mathloadingfalse`.\nl - \`\doloadmath` allows Unicode-math loading by \`\_mathloadingtrue`. - \_cod ----------------------------- - -\_newifi \_ifmathloading \_mathloadingtrue - -\_def\_noloadmath{\_mathloadingfalse} -\_def\_doloadmath{\_mathloadingtrue} - -\_def\_loadmath#1{% - \_ifmathloading - \_initunifonts - \_isfont{#1}\_iffalse - \_opwarning{Math font "#1" not found, skipped...}% - \_else - \_def\_unimathfont{#1}% - \_let\_normalmath = \_normalunimath \_let\_boldmath = \_boldunimath - \_normalmath - \_wterm {MATH-FONT: "#1" -- unicode math prepared.}% - \_ifx\_ncharrmA\_undefined \_opinput {unimath-codes.opm}\_fi - \_mathloadingfalse - \_fi\_fi} - -\_public \loadmath \noloadmath \doloadmath ; - - \_doc ----------------------------- - \`\loadboldmath` `{} \to {}` - defines \`\_unimathboldfont` as `` only if `\_unimathfont` is - defined as ``. It is used when \^`\boldmath` macro is run. - When no `\_unimathboldfont` is defined then the `\boldmath` macro - use \"fake bold" generated by `embolden` \LuaTeX/ font feature. - \_cod ----------------------------- - -\_def\_loadboldmath#1#2\to #3{% - \_def\_tmp{#3}\_ifx\_unimathfont\_tmp % do work only if #3 is loaded as normal Math - \_isfont{#1}\_iffalse - \_opwarning{Bold-Math font "#1" not found, skipped...} - \_else - \_def\_unimathboldfont{#1}% - \_wterm {MATH-FONT: "#1" -- unicode math bold prepared.}% - \_fi\_fi} - -\_public \loadboldmath ; - - \_doc ----------------------------- - The Unicode version of the \^`\normalmath` and \^`\boldmath` macros - are defined here as \`\_normalunimath` and \`\_boldunimath` macros. - They are using \`\_setunimathdimens` in a similar sense as - \^`\_setmathdimens`. - \nl - You can combine more fonts if you register them to another - math families (5, 6, 7, etc.) in the \^`\normalmath` macro. - \nl - The default value of \^`\_normalunimath` shows a combination of base Unicode-math - font with 8bit Math font at family 4. See definition of `\script` macro where - `\fam4` is used. - \_cod ----------------------------- - -\_def\_normalunimath{% - \_loadumathfamily 1 {\_unimathfont}{} % Base font - \_loadmathfamily 4 rsfs % script - \_setunimathdimens -}% -\_def\_boldunimath{% - \_ifx\_unimathboldfont \_undefined - \_loadumathfamily 1 {\_unimathfont}{embolden=1.7;} % Base faked bold - \_else - \_loadumathfamily 1 {\_unimathboldfont}{} % Base real bold font - \_fi - \_loadmathfamily 4 rsfs % script - \_setunimathdimens -}% -\_def\_setunimathdimens{% PlainTeX sets these dimens for 10pt size only: - \_delimitershortfall=0.5\_fontdimen6\_textfont1 - \_nulldelimiterspace=0.12\_fontdimen6\_textfont1 - \_setmathparam\_Umathspaceafterscript \_scriptspacefactor - \_setbox0=\_hbox{\_everymath{}$\_fam1\_displaystyle{0\_atop0}$}% - \_Umathfractiondelsize\_displaystyle = \_dimexpr(\_ht0-\_Umathaxis\_displaystyle)*2\_relax - \_setbox0=\_box\_voidbox -} - - \_doc ----------------------------- - If you try the example above about - \~`\loadboldmath``{[xitsmath-bold]} \to {[xitsmath-regular]}` - then you can find a bug in XITSMath-Bold font: the symbols for norm - $\|x\|$ are missing. So, we have to define `\_boldmath` macro manually. - The missing symbol is loaded from family 5 as no-bold variant in our example: - \begtt - \loadmath{[xitsmath-regular]} - \def\_boldmath{% - \_loadumathfamily 1 {[xitsmath-bold]}{} % Base font - \_loadmathfamily 4 rsfs % script - \_loadumathfamily 5 {[xitsmath-regular]}{} - \_def\|{\_Udelimiter 0 5 "02016 }% % norm delimiter from family 5 - \_setmathdimens - } - \endtt - - \`\_loadumathfamily` ` {}{}` - loads the given Unicode-math fonts in three sizes - using single with different `mathsize=1,2,3` font features. - The math font family is set with given ``. - The `` are added to the default - \`\_mfontfeatures` and to the size-dependent features `ssty=1` - if script size is asked or `ssty=2` if scriptscriptsize is asked.\nl - \`\_mparams``` inserts additional font feature `nomathparam` - if the of the family is greater than 3. Lua\TeX/ sets math - parameters (thickness of fraction rules etc., see section 7.4 in Lua\TeX/ - documentation) repeatedly from loaded math - fonts if `nomathparam` is not given. We want to load these parameters only - from fonts at families 0--3 (and actually we are using only family 1 as main math font).\nl - The \^`\_corrmsize` `` can be used just before - `\_loadumathfamily`, see section~\ref[math-preload] for more information.\nl - The \`\_textmff`, \`\_scriptmff` and \`\_sscriptmff` are font - features for text, script and sscript sizes respectively. They are - locally re-defined in \^`\mathbox` macro. - \_cod ----------------------------- - -\_def\_umathname#1#2{"#1:\_mfontfeatures#2"} -\_def\_mfontfeatures{mode=base;script=math;} - -\_def\_loadumathfamily #1 #2#3 {% - \_font\_mF=\_umathname{#2}{\_textmff \_mparams{#1}#3} at\_sizemtext \_textfont #1=\_mF - \_font\_mF=\_umathname{#2}{\_scriptmff \_mparams{#1}#3} at\_sizemtext \_scriptfont #1=\_mF - \_font\_mF=\_umathname{#2}{\_sscriptmff\_mparams{#1}#3} at\_sizemtext \_scriptscriptfont#1=\_mF - \_ptmunit=\_ptunit -} -\_def\_textmff {ssty=0;mathsize=1;} -\_def\_scriptmff {ssty=1;mathsize=2;} -\_def\_sscriptmff{ssty=2;mathsize=3;} -\_def\_mparams#1{\_ifnum#1>3 nomathparam;\_fi} - - \_doc ----------------------------- - Unicode math font includes all typical math alphabets together, user needs not to - load more \TeX/ math families. These math alphabets are encoded by - different parts of Unicode table. We need auxiliary macros for setting - mathcodes by selected math alphabet. - \nl - \`\_umathrange` `{-}\` sets `\Umathcode`s - of the characters in the interval `-` to `\`, - `\+1`, `\+2` - etc., but \`\_umathcharholes` are skipped - (`\_umathcharholes` are parts of the Unicode table not designed for math - alphabets, they cause that the math alphabets are - not continuously spread out in the table; I mean that the - designers were under the influence of drugs when they created - this part of the Unicode table). - The `-` clause includes characters like~`A-Z`. - \nl - \`\_umahrangegreek` `\` is the same as - `\_umathrange {-}\`. - \nl - \`\_umahrangeGREEK` `\` is the same as - `\_umathrange {-}\`. - \nl - \`\_greekdef` ` \_relax` defines each control sequence - as a normal character with codes `\_umathnumB`, `\_umathnumB+1`, - `\_umathnumB+2` etc. It is used for redefinig the contol sequences for - math Greek `\alpha`, `\beta`, `\gamma` etc. - \_cod ----------------------------- - -\_newcount\_umathnumA \_newcount\_umathnumB - -\_def\_umathcorr#1#2{\_ea#1\_ea{\_the#2}} -\_def\_umathprepare#1{\_def\_umathscanholes##1[#1]##2##3\_relax{##2}} -\_def\_umathvalue#1{\_ea\_umathscanholes\_umathcharholes[#1]{#1}\_relax} - -\_def\_umathcharholes{% holes in math alphabets: - [119893]{"210E}[119965]{"212C}[119968]{"2130}[119969]{"2131}% - [119971]{"210B}[119972]{"2110}[119975]{"2112}[119976]{"2133}[119981]{"211B}% - [119994]{"212F}[119996]{"210A}[120004]{"2134}% - [120070]{"212D}[120075]{"210C}[120076]{"2111}[120085]{"211C}[120093]{"2128}% - [120122]{"2102}[120127]{"210D}[120133]{"2115}[120135]{"2119} - [120136]{"211A}[120137]{"211D}[120145]{"2124}% -} -\_def\_umathrange#1#2#3#4{\_umathnumB=#4\_def\_tmp{#2 #3 }\_umathrangeA#1} -\_def\_umathrangeA#1-#2{\_umathnumA=`#1\_relax - \_loop - \_umathcorr\_umathprepare\_umathnumB - \_Umathcode \_umathnumA = \_tmp \_umathcorr\_umathvalue{\_umathnumB} - \_ifnum\_umathnumA<`#2\_relax - \_advance\_umathnumA by1 \_advance\_umathnumB by1 - \_repeat -} -\_def\_umathrangeGREEK{\_umathrange{^^^^0391-^^^^03a9}} -\_def\_umathrangegreek{\_umathrange{^^^^03b1-^^^^03d6}} -\_def\_greekdef#1{\_ifx#1\_relax \_else - \_begingroup \_lccode`X=\_umathnumB \_lowercase{\_endgroup \_def#1{X}}% - \_advance\_umathnumB by 1 - \_ea\_greekdef \_fi -} - - \_doc ----------------------------- - \`\addUmathfont` ` {[]}{} {[]}{} {}` - allocates new using \^`\newfam` and adds loading this font to the - \~`\normalmath` and \~`\boldmath` macros. Note that allocationos using - \^`\newfam` starts from 43 because numbers 1--42 are reserved for direct - usage without \^`\newfam`. - \_cod ----------------------------- - -\_def\_addUmathfont #1#2#3#4#5#6{% #1: fam (will be set), #2#3: normal font, #4#5: bold font - \_ifx\_ncharrmA\_undefined \_errmessage{basic Unicode math font must be loaded first}% - \_else \_isfont{#2}\_iffalse \_opwarning{font #2 is unavailable}% - \_else - \_newfam#1\_relax - \_global\_addto\_normalmath{\_corrmsize#6 \_loadumathfamily #1 {#2}{#3} }% - \_ifx\_relax#4\_relax - \_global\_addto\_boldmath{\_corrmsize#6 \_loadumathfamily #1 {#2}{embolden=1.7;} }% - \_else - \_global\_addto\_boldmath{\_corrmsize#6 \_loadumathfamily #1 {#4}{#5} }% - \_fi - \_normalmath - \_wterm{add-MATH-FONT: #1=\the#1, "#2", \ifx"#4"\else bold: "#4"\fi}% - \_fi \_fi -} - - \_doc ----------------------------- - \`\resetmathchars` ` ;` - saves to \`\_mafam` and applies \`\_resetmathcharsX` - to each sequence from . - The `\directlua` chunk prints the 8-digits hexadecimal code of the - sequence followed by the sequence itself. The digts are scanned by \`\_resetmathcharsY` - and new `\Umathchardef` and `\Umathcode` is declared. Note that the used - primitives have the syntax: - \begtt \catcode`<=13 - \Umathchardef - \Umathcode - \endtt - \_cod ----------------------------- - -\_def\_resetmathchars #1{\_chardef\_mafam=#1\_relax \_xargs \_resetmathcharX} -\_def\_resetmathcharX#1{\_ea\_resetmathcharY - \_directlua{tex.print(string.format("\_pcent08X", \_the#1))}#1} -\_def\_resetmathcharY#1#2#3#4#5#6#7#8#9{% #9 is given \math-sequence - \_Umathchardef #9\_numexpr"#3/2\_relax \_mafam "#4#5#6#7#8 - \_Umathcode "#4#5#6#7#8=\_numexpr"#3/2\_relax \_mafam "#4#5#6#7#8 -} -\_public \addUmathfont \resetmathchars ; - -\_endcode - - -The \^`\loadmath` `{}` macro loads math fonts and -redefines all default math-codes using `\input unimath-codes.opm`. -If Unicode-math font is loaded then \^`\_mathloadingfalse` -is set, so the new Unicode-math font isn't loaded until \^`\doloadmath` is used. - -\^`\loadboldmath` `{} \to {}` loads bold variant only -if `` was sucessully loaded by the previous `\loadmath`. For example: - -\begtt -\loadmath {[xitsmath-regular]} -\loadboldmath {[xitsmath-bold]} \to {[xitsmath-regular]} -\endtt -There are very few Unicode-math fonts with full \~`\boldmath` support. -I know only XITSMath-Bold and KpMath-Bold. If \^`\loadboldmath` is not used -then \"faked bold" created from \~`\normalmath` is used by default. - -The {\em main math font} is loaded by \^`\loadmath` (typically indirectly using -\^`\fontfam`) and you can load more {\em additional math fonts} by -\^`\addUmathfont`: -\begtt \catcode`<=13 -\addUmathfont \famname {[]}{} {[]}{} {} -\endtt -The `\famname` is a control sequence declared by \^`\addUmathfont` for later -use. It gets math family number. The `` is decimal number for size -corrections in view of the main math font. If it is empty then =1. -If is empty, the \"faked bold" derived from is used. -Example: -\begtt -\fontfam[lm] % does \lodmath{[latinmodern-math]} -\addUmathfont \xits {[XITSMath-Regular]}{} {[XITSMath-Bold]}{} {} -\endtt -% -declares `latinmodern-math` as main math font (its bold variant is \"faked bold") -and the additional math font `\xits` is `XITSMath-Regular` for normal -printing and `XITSMath-Bold` for bold printing. - -All characters used in math formula is printed from main math font by -default. But you can redeclare a list of characters for printing from -additional font by \^`\resetmathchars` `\famname ;`. For -example: - -\begtt -\resetmathchars \xits \stareq \triangleq \veeeq \wedgeq ; -\endtt -% -sets the characters `\stareq`, `\triangleq`, `\veeeq`, `\wedgeq` from -the `\xits` additional font. You can see all possible sequences by -`\input print-unimath.opm`. -If you want to use whole math alphabet from additional math font, use -`\addto\selector{\fam\famname}`, for example `\addto\cal{\fam\xits}` -declares all `\cal` characters from the `\xits` font loaded by -\^`\addUmathfont`. - - -\secc Unicode-math macros preloaded in the format - -\printdoc math-unicode.opm - - -\secc[unimath-codes] Macros and codes set when `\loadmath` is processed firstly - -The file `unimath-codes.opm` is loaded when the \^`\loadmath` is used. The -macros here redefines globally all encoding dependent settings declared in -the section~\ref[math-macros]. - -\printdoc unimath-codes.opm -\printdoctail unimath-codes.opm - -\secc Printing all Unicode math slots in used math font - -\printdoctail print-unimath.opm -\printdoc print-unimath.opm - -\_endinput - -2022-07-22 \Umathspaceafterscript setting added. -2022-06-10 \addUmathfont and \resetmathchars added. -2021-08-16 \_loadumathfamily simplified, used mathsize= font feature. -2021-08-16 nomathparam font feature used for families > 3 (bug fixed). -2021-08-02 ssty fontfeatures rewritten; fam2, fam3 unused, \scriptspace not set -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 -2020-06-07 \Umathfractiondelsize (for \choose brackets) corrected, see https://tug.org/pipermail/luatex/2020-June/007365.html -2020-04-15 \_setmathdimens -> \_setuniathdimens -2020-02-25 implemented diff --git a/macros/optex/base/more-macros.opm b/macros/optex/base/more-macros.opm index f256458184..418e71b774 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 macros <2022-05-24>} % preloaded in format +\_codedecl \eoldef {OpTeX useful macros <2022-11-24>} % preloaded in format \_doc ----------------------------- We define \`\opinput` `{}` macro which @@ -89,7 +89,7 @@ loaded file is forgotten after the `\opinput`. \_cod ----------------------------- -\_def \_load [#1]{\_loadA #1,,,\_end} +\_def \_load [#1]{\_savemathsb \_loadA #1,,,\_end \_restoremathsb} \_def \_loadA #1#2,{\_ifx,#1 \_ea \_loadE \_else \_loadB{#1#2}\_ea\_loadA\_fi} \_def \_loadB #1{% \_ifcsname _load:#1\_endcsname \_else @@ -105,25 +105,29 @@ The declarator \`\optdef``\macro [] {}` defines the `\macro` with the optional parameter followed by normal parameters declared in ``. The optional parameter must be used as the first - first parameter in brackets `[...]`. If it isn't used then + parameter in brackets `[...]`. If it isn't used then is taken into account. The `` can use `\the\opt` because optional parameter is saved to the \`\opt` tokens register. Note the difference from \LaTeX/ concept where the optional parameter is in `#1`. \OpTeX/ uses `#1` as the first normal parameter (if declared). - The \`\_nospaceafter` ignores the following optional space at expand + The \`\nospaceafter` ignores the following optional space at expand processor level using the negative `\romannumeral` trick. + The \`\nospacefuturelet` bahaves like `\futurelet` primitive, but it + ignores the following optional space and works at expand processor level. \_cod ----------------------------- +\_newtoks\_opt \_def\_optdef#1[#2]{% \_def#1{\_opt={#2}\_isnextchar[{\_cs{_oA:\_csstring#1}}{\_cs{_oB:\_csstring#1}}}% \_sdef{_oA:\_csstring#1}[##1]{\_opt={##1}\_cs{_oB:\_csstring#1\_nospaceafter}}% \_sdef{_oB:\_csstring#1\_nospaceafter}% } -\_def\_nospaceafter#1{\_ea#1\_romannumeral-`\.} -\_newtoks\_opt +\_def\_nospaceafter#1{\_ea#1\_romannumeral-`\.\_noexpand} +\_def\_nospacefuturelet#1#2{\_ea\_immediateassignment + \_ea\_futurelet\_ea#1\_ea#2\_romannumeral-`\.\_noexpand} -\_public \opt \optdef ; +\_public \opt \optdef \nospaceafter \nospacefuturelet ; \_doc ----------------------------- The declarator \`\eoldef``\macro #1{}` defines a `\macro` @@ -150,8 +154,8 @@ \_eoldef\_skiptoeol#1{} \_def\_bracedparam#1{\_ifcsname _\_csstring #1:M\_endcsname \_csname _\_csstring #1:M\_ea \_endcsname - \_else \_csname __in\_csstring #1:M\_ea \_endcsname \_fi -} + \_else \_csname _in\_csstring #1\_ea \_endcsname \_fi +} \_public \eoldef \skiptoeol \bracedparam ; \_doc ----------------------------- @@ -170,10 +174,10 @@ the next line continues. \_cod ----------------------------- -\_def\_scantoeol#1{\def\_tmp{#1}\_begingroup \_setscancatcodes \_scantoeolA} +\_def\_scantoeol#1{\_begingroup \_setscancatcodes \_scantoeolA #1} \_def\_setscancatcodes{\_setverb \_catcode`\^^M=12\_catcode`\^=7\_catcode`\ =10\_catcode`\^^J=14 } \_catcode`\^^M=12 % -\_def\_scantoeolA#1^^M{\_endgroup \_tmp{#1}}% +\_def\_scantoeolA#1#2^^M{\_endgroup #1{#2}}% \_normalcatcodes % \_public \scantoeol ; @@ -194,13 +198,20 @@ It finishes processing or appends the next part to `\_tmptoks` separated by and continues loop. The final part of the macro removes the last `?` from resulting `\_tmptoks` and defines a new version of the `\foo`. + + The \^`\replstring` macro is not expandable, but you can create your + expandable macro, for example: + \begtt + \def\replAB#1{\immediateassigned{\def\tmp{#1}\replstring\tmp{A}{B}}\the\_tmptoks} + \replAB {text A \and A} % expands to "text B \and B" + \endtt \_cod ----------------------------- \_newtoks\_tmptoks \_catcode`!=3 \_catcode`?=3 \_def\_replstring #1#2#3{% \replstring #1{stringA}{stringB} \_long\_def\_replacestringsA##1#2{\_tmptoks{##1}\_replacestringsB}% - \_long\_def\_replacestringsB##1#2{\_ifx!##1\_relax \_else \_toksapp\_tmptoks{#3##1}% + \_long\_def\_replacestringsB##1#2{\_ifx!##1\_relax \_else \_tmptoks\_ea{\_the\_tmptoks#3##1}% \_ea\_replacestringsB\_fi}% \_ea\_replacestringsA #1?#2!#2% \_long\_def\_replacestringsA##1?{\_tmptoks{##1}\_edef#1{\_the\_tmptoks}}% @@ -232,7 +243,22 @@ \_def\_removespaces #1 {\_isempty{#1}\_iffalse #1\_ea\_removespaces\_fi} \_ea\_def \_ea\_ignorept \_ea#\_ea1\_detokenize{pt}{#1} -\public \removespaces \ignorept ; +\_public \removespaces \ignorept ; + + \_doc ----------------------------- + If you do `\let\foo=a` then it is not simple to return from `\foo` to the original + character code of `a`. You can write \code{`a} but you cannot write \code{`\\foo}. + The macro \`\cstochar``` solves this problem. If the sequence + is equal to a character then it expands to this character (always with + catcode 12). If it isn't equal to a character then it expands to nothing. + You can say \code{\\expanded{`\\cstochar\\foo}} if you want to extract + the character code. + \_cod ----------------------------- + +\_def\_cstochar#1{\_ea\_cstocharA\_meaning#1 {} {} \_fin} +\_def\_cstocharA#1 #2 #3 #4\_fin{\_isinlist{#1#2}-\_iffalse #3\_fi} + +\_public \cstochar ; \_doc ----------------------------- You can use expandable \`\bp``{}` convertor from @@ -261,6 +287,53 @@ \_public \expr \bp ; + \_doc ------------------ + You can write \^`\setpos``[ = + \Udelcode = + \endtt + \_cod ----------------------------- + +\_def\_mathchars {\_afterassignment\_mathcharsA \_chardef\_mafam=} +\_def\_mathcharsA #1{\_foreach #1\_do{% + \_ifcsname _d:\_csstring##1\_endcsname \_ea \_mathcharsD \_csname _d:\_csstring##1\_endcsname + \_else \_mathcharsC ##1\_fi +}} +\_def\_mathcharsC #1{\_ea\_mathcharsB + \_directlua{tex.print(string.format("\_pcent08X", \_the\_Umathcode#1))}#1% +} +\_def\_mathcharsB #1#2#3#4#5#6#7#8#9{% #9 is given \math-sequence + \_ifcsname _\_csstring#9op\_endcsname + \_ea \_Umathchardef \_csname _\_csstring#9op\_endcsname=1 \_mafam #9\_relax + \_else + \_Umathcode "#4#5#6#7#8=\_numexpr"#3/2\_relax \_mafam "#4#5#6#7#8 + \_fi +} +\_def\_mathcharsD #1{\_mathcharsC #1\_relax \_Udelcode #1=\_mafam #1\_relax} + + \_doc ----------------------------- + \`\mathcodes` ` {}` sets mathcodes of given + characters with explicit es. Each pair can be `{}` + and `` can include \`\Urange` `-`. + This is reason why we apply `\expanded` to the `` + before reading it by \^`\foreach`: the \^`\Urange` is expandable + and expands to the relevant list of characters. + \_cod ----------------------------- + +\_def\_mathcodes{\_afterassignment\_mathcodesA\_chardef\_mafam=} +\_def\_mathcodesA#1{% + \_foreach #1\_do ##1##2{% + \_ea\_foreach\_expanded{##2}\_do{\_Umathcode `####1=##1\_mafam`####1}% + }% +} +\_def\_Urange #1-#2{\_fornum `#1..`#2\_do{\_Uchar##1 }} + +\_public \addUmathfont \mathchars \mathcodes \Urange ; + +\_endcode + + +The \^`\loadmath` `{}` macro loads math fonts and +redefines all default math-codes using `\input unimath-codes.opm`. +If Unicode-math font is loaded then \^`\_mathloadingfalse` +is set, so the new Unicode-math font isn't loaded until \^`\doloadmath` is used. + +\^`\loadboldmath` `{} \to {}` loads bold variant only +if `` was sucessully loaded by the previous `\loadmath`. For example: + +\begtt +\loadmath {[xitsmath-regular]} +\loadboldmath {[xitsmath-bold]} \to {[xitsmath-regular]} +\endtt +There are very few Unicode-math fonts with full \~`\boldmath` support. +I know only XITSMath-Bold and KpMath-Bold. If \^`\loadboldmath` is not used +then \"faked bold" created from \~`\normalmath` is used by default. + +The {\em main math font} is loaded by \^`\loadmath` (typically indirectly using +\^`\fontfam`) and you can load more {\em additional math fonts} by +\^`\addUmathfont`: +\begtt \catcode`<=13 +\addUmathfont \famname {[]}{} {[]}{} {} +\endtt +The `\famname` is a control sequence declared by \^`\addUmathfont` for later +use. It gets math family number. The `` is decimal number for size +corrections in view of the main math font. If it is empty then =1. +If is empty, the \"faked bold" derived from is used. +Example: +\begtt +\fontfam[lm] % does \lodmath{[latinmodern-math]} +\addUmathfont \xits {[XITSMath-Regular]}{} {[XITSMath-Bold]}{} {} +\endtt +% +declares `latinmodern-math` as main math font (its bold variant is \"faked bold"). +The additional math font family `\xits` is declared in the example. It uses +`XITSMath-Regular` for normal printing and `XITSMath-Bold` for bold printing. + +All characters used in math formula are printed from main math font by +default. But you can re-declare characters for printing from +additional font by \^`\mathchars` `\famname {}`. For +example: + +\begtt +\mathchars \xits {\stareq \triangleq \veeeq \wedgeq} +\endtt +% +sets the characters `\stareq`, `\triangleq`, `\veeeq`, `\wedgeq` from +the `\xits` additional font. The can include +control sequences from the `unicode-table.tex`, but no math +accents. These contol sequences can be printed by `\input print-unimath.opm`. + +The \^`\mathchars` macro keeps the class and slot of declared math objects +and re-declares only family of them. It is applied to all control +sequences given in the parameter. The relevant math codes are re-declared. + +Use `\addto\selector{\fam\famname}` if you want to print whole math alphabet +from an additional math font. For example `\addto\cal{\fam\xits}` +declares all `\cal` characters from the `\xits` font loaded by +\^`\addUmathfont`. + +The \^`\mathcodes` macro provides comfortable settings of math codes of math +objects. Its syntax is \^`\mathcodes` ` {}`. Each pair +in the is `` (separated by optional +space) or `{}`. The +includes declared characters or \^`\Urange` `-` which is equal to the +list of characters beginning and ending , for example +`\Urange a-d` is equal to `abcd`. + +The \^`\mathcodes` macro declares mathcode of given characters internally by +\begtt \catcode`<=13 +\Umathcode ` = ` +\endtt + +The \^`\mathcodes` macro sets math codes of given Unicode characters. +The relevant control sequence from `unicode-table.tex` changes its +behavior too. For example, If you change math code of × then the +`\times` control sequence will behave like new declared ×. + + +\secc Unicode-math macros preloaded in the format + +\printdoc unimath-macros.opm + + +\secc[unimath-codes] Macros and codes set when `\loadmath` is processed firstly + +The file `unimath-codes.opm` is loaded when the \^`\loadmath` is used. The +macros here redefines globally all encoding dependent settings declared in +the section~\ref[math-macros]. + +\printdoc unimath-codes.opm +\printdoctail unimath-codes.opm + +\secc Printing all Unicode math slots in used math font + +\printdoctail print-unimath.opm +\printdoc print-unimath.opm + +\_endinput + +2022-12-01 reading number by \_loadumathfamily more robust +2022-11-18 \mathchars improved, \Udelcodes are set too, \addUmathfont uses \ahead +2022-11-17 \Umathchardef replaced by \chardef +2022-11-16 \resetmathchars removed, \mathchars, \mathcodes introduced +2022-11-13 \_setfontfamily 0 added. +2022-07-22 \Umathspaceafterscript setting added. +2022-06-10 \addUmathfont and \resetmathchars added. +2021-08-16 \_loadumathfamily simplified, used mathsize= font feature. +2021-08-16 nomathparam font feature used for families > 3 (bug fixed). +2021-08-02 ssty fontfeatures rewritten; fam2, fam3 unused, \scriptspace not set +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 +2020-06-07 \Umathfractiondelsize (for \choose brackets) corrected, see https://tug.org/pipermail/luatex/2020-June/007365.html +2020-04-15 \_setmathdimens -> \_setuniathdimens +2020-02-25 implemented diff --git a/macros/optex/base/verbatim.opm b/macros/optex/base/verbatim.opm index 201dc66fd9..ac00369d33 100644 --- a/macros/optex/base/verbatim.opm +++ b/macros/optex/base/verbatim.opm @@ -138,7 +138,7 @@ } \_ea\_def\_ea\_startverb \_ea#\_ea1\_csstring\\endtt#2^^J{% \_prepareverbdata\_tmpb{#1^^J}% - \_ea\_printverb \_tmpb\_end + \_ea\_printverb \_tmpb\_fin \_par \_restoremathsb \_endgroup \_ttskip \_isnextchar\_par{}{\_noindent}% @@ -172,10 +172,10 @@ \_ifx\_printverblinenum\_relax \_else \_incr\_ttline \_fi \_testcommentchars #1\_relax\_relax\_relax \_iftrue - \_ifx\_end#2\_printcomments\_fi + \_ifx\_fin#2\_printcomments\_fi \_else \_ifx\_vcomments\_empty\_else \_printcomments \_def\_vcomments{}\_fi - \_ifx\_end#2% + \_ifx\_fin#2% \_bgroup \_adef{ }{}\_def\t{}% if the last line is emtpy, we don't print it \_ifcat&\_egroup \_ifx\_printverblinenum\_relax \_else \_decr\_ttline \_fi \_else\_egroup \_printverbline{#1}\_fi @@ -183,7 +183,7 @@ \_printverbline{#1}% \_fi \_fi - \_unless\_ifx\_end#2\_afterfi{\_printverb#2}\_fi + \_unless\_ifx\_fin#2\_afterfi{\_printverb#2}\_fi } \_def\_printverbline#1{\_putttpenalty \_indent \_printverblinenum \_kern\_ttshift #1\_par} \_def\_initverblinenum{\_tenrm \_thefontscale[700]\_ea\_let\_ea\_sevenrm\_the\_font} @@ -274,7 +274,7 @@ \_repeat \_ea\_prepareverbdata \_ea \_tmpb\_ea{\_tmpb^^J}% \_catcode`\ =10 \_catcode`\%=9 % used in \commentchars comments - \_ea\_printverb \_tmpb\_end + \_ea\_printverb \_tmpb\_fin \_ttlinesave \_par \_restoremathsb \_endgroup -- cgit v1.2.3