diff options
author | Norbert Preining <norbert@preining.info> | 2020-03-21 03:01:37 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-03-21 03:01:37 +0000 |
commit | 3e43bc594a14e8c4fc21d6a71f22a23dd78fe252 (patch) | |
tree | 19d1a8bb88da795b5317f91775f645e0b7bd9eb9 /macros/luatex/optex | |
parent | c720a4409b388fa706f3eb1ce275f76f7d49d996 (diff) |
CTAN sync 202003210301
Diffstat (limited to 'macros/luatex/optex')
57 files changed, 1207 insertions, 463 deletions
diff --git a/macros/luatex/optex/README b/macros/luatex/optex/README index 50bc986aa0..5217287f83 100644 --- a/macros/luatex/optex/README +++ b/macros/luatex/optex/README @@ -8,6 +8,9 @@ See http://petr.olsak.net/optex History: +<0.07> demos: op-letter.tex and op-slides.tex added. + \inkinspic, \transformbox, \slides added. + documentation improved and updated. <0.06> tables re-implemented, opmac-rest removed. footnotes, marginal notes reimplemented. sections.opm, graphics.opm, colors.opm, languages re-implemented diff --git a/macros/luatex/optex/alloc.opm b/macros/luatex/optex/alloc.opm index 6ca5939ab1..81d9e6606d 100644 --- a/macros/luatex/optex/alloc.opm +++ b/macros/luatex/optex/alloc.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \newdimen {Allocators for registers <2020-01-23>} +\_codedecl \newdimen {Allocators for registers <2020-01-23>} % loaded in format \_chardef\_maicount = 65535 % Max Allocation Index for counts registers in LuaTeX \_let\_maidimen = \_maicount diff --git a/macros/luatex/optex/basics-macros.opm b/macros/luatex/optex/basics-macros.opm index 23b6a6a43c..b86fd2e2e9 100644 --- a/macros/luatex/optex/basics-macros.opm +++ b/macros/luatex/optex/basics-macros.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \sdef {Basic macros for OpTeX <2020-02-14>} +\_codedecl \sdef {Basic macros for OpTeX <2020-02-14>} % loaded in format \_doc ------------------------------ `\bgroup`, `\egroup`, `\empty`, `\space`, `\null` and `\wlog` are classical diff --git a/macros/luatex/optex/bib-iso690.opm b/macros/luatex/optex/bib-iso690.opm index 8f341330c6..3265eaea05 100644 --- a/macros/luatex/optex/bib-iso690.opm +++ b/macros/luatex/optex/bib-iso690.opm @@ -1,6 +1,6 @@ % This is part of OpTeX project, see http://petr.olsak.net/optex -% bibliography style (iso690), version <2020-03-10> +% bibliography style (iso690), version <2020-03-10>, loaded on demand by \usebib \_ifx\_optexbibstyle\_undefined \_errmessage {This file can be read by: \_string\usebib/? (iso690) bibfiles command only} diff --git a/macros/luatex/optex/bib-simple.opm b/macros/luatex/optex/bib-simple.opm index 46824cb81d..347d90bb14 100644 --- a/macros/luatex/optex/bib-simple.opm +++ b/macros/luatex/optex/bib-simple.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -% bibliography style (simple), version <2020-03-10> +% bibliography style (simple), version <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/luatex/optex/cite-bib.opm b/macros/luatex/optex/cite-bib.opm index 505b18bb35..7f5b184d93 100644 --- a/macros/luatex/optex/cite-bib.opm +++ b/macros/luatex/optex/cite-bib.opm @@ -187,6 +187,7 @@ \_def\_bibB[#1]{\_par \_bibskip \_advance\_bibnum by1 \_noindent \_def\_tmpb{#1}\_wbib{#1}{\_the\_bibnum}{\_the\_bibmark}% + \_printlabel{#1}% \_printbib \_ignorespaces } \_def\_wbib#1#2#3{\_dest[cite:\_the\_bibnum]% diff --git a/macros/luatex/optex/colors.opm b/macros/luatex/optex/colors.opm index 52dd349f5e..c4ce83ecd9 100644 --- a/macros/luatex/optex/colors.opm +++ b/macros/luatex/optex/colors.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \colordef {Colors <2020-03-07>} +\_codedecl \colordef {Colors <2020-03-18>} % loaded in format \_doc ----------------------------- We declare internal boolean value `\_iflocalcolor` ad do @@ -107,7 +107,7 @@ \_cod ----------------------------- \_def\_rgbtocmyk #1 #2 #3 ;{% - \_ea \_stripzeros \_directlua{ + \_ea \_stripzeros \_detokenize \_ea{\_directlua{ local kr = math.max(#1,#2,#3) if (kr==0) then tex.print('0. 0. 0. 1 ;') @@ -115,23 +115,23 @@ tex.print(string.format('\_pcent.3f \_pcent.3f \_pcent.3f \_pcent.3f ;', (kr-#1)/kr, (kr-#2)/kr, (kr-#3)/kr, 1-kr)) end -}} +}}} \_def\_cmyktorgb #1 #2 #3 #4 ;{% - \_ea \_stripzeros \_directlua{ + \_ea \_stripzeros \_detokenize \_ea{\_directlua{ local kr = 1-#4 tex.print(string.format('\_pcent.3f \_pcent.3f \_pcent.3f ;', (1-#1)*kr, (1-#2)*kr, (1-#3)*kr)) -}} +}}} \_def\_colorcrop{\_directlua{ local m=math.max(color_C, color_M, color_Y, color_K) if (m>1) then color_C=color_C/m color_M=color_M/m color_Y=color_Y/m color_K=color_K/m end }} -\_def\_colordefFin{\_colorcrop \_ea \_stripzeros \_directlua{ +\_def\_colordefFin{\_colorcrop \_ea \_stripzeros \_detokenize \_ea{\_directlua{ tex.print(string.format('\_pcent.3f \_pcent.3f \_pcent.3f \_pcent.3f ;', color_C, color_M, color_Y, color_K)) -}} +}}} \_def\_douseK{\_colorcrop \_directlua{ kr=math.min(color_C, color_M, color_Y) if (kr>=1) then diff --git a/macros/luatex/optex/doc/op-ring.png b/macros/luatex/optex/doc/op-ring.png Binary files differdeleted file mode 100644 index 8c8cb5976a..0000000000 --- a/macros/luatex/optex/doc/op-ring.png +++ /dev/null diff --git a/macros/luatex/optex/doc/optex-doc.pdf b/macros/luatex/optex/doc/optex-doc.pdf Binary files differindex 66f676f54e..8ce027841f 100644 --- a/macros/luatex/optex/doc/optex-doc.pdf +++ b/macros/luatex/optex/doc/optex-doc.pdf diff --git a/macros/luatex/optex/doc/optex-doc.tex b/macros/luatex/optex/doc/optex-doc.tex index 155499cba4..7035a0866f 100644 --- a/macros/luatex/optex/doc/optex-doc.tex +++ b/macros/luatex/optex/doc/optex-doc.tex @@ -8,7 +8,7 @@ \def<#1>{\hbox{$\langle$\it#1\/$\rangle$}} \everyintt={\catcode`\<=13} \everytt=\everyintt -\chardef\"="201C +\enquotes \def\new{\mnote{\Red$\blacktriangleleft$}} \fixmnotes\right @@ -22,16 +22,16 @@ \tit \OpTeX/\nl Format Based on Plain \TeX/ and OPmac\fnotemark1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\hfill Version 0.06 +\hfill Version 0.07 \centerline{\it Petr Olšák, 2020} \bigskip \centerline{\url{http://petr.olsak.net/optex}} -\fnotetext {The OPmac package is a set of simple additional macros to plain\TeX{}. It +\fnotetext {The OPmac package is a set of simple additional macros to Plain \TeX{}. It enables users to take advantage of basic \LaTeX/ functionality but keeps -plain \TeX/ simplicity. See +Plain \TeX/ simplicity. See \url{http://petr.olsak.net/opmac-e.html} for more information about it. For OPmac users: the red triangle {\Red$\blacktriangleleft$} in the right margin means that there is a difference from standard OPmac features.} @@ -42,11 +42,11 @@ means that there is a difference from standard OPmac features.} \nonum \sec Introduction %%%%%%%%%%%% -\OpTeX/ is \LuaTeX/ format with plain \TeX/ and OPmac. Only \LuaTeX/ engine +\OpTeX/ is \LuaTeX/ format with Plain \TeX/ and OPmac. Only \LuaTeX/ engine is supported. The main goal of \OpTeX/ is: \begitems -* \OpTeX/ keeps the simplicity (like in plain \TeX/ and OPmac macros). +* \OpTeX/ keeps the simplicity (like in Plain \TeX/ and OPmac macros). * There is no old obscurities concerning with various 8-bit encodings and various engines. * \OpTeX/ provides a powerful font selection system (for Unicode font @@ -54,12 +54,12 @@ is supported. The main goal of \OpTeX/ is: * \OpTeX/ supports hyphenations of all languages installed in your \TeX/ system. * All features from OPmac macros are copied. * Macros are documented in the same place where code is (macros for printing - this documentation will come in the future). + such documentation will come in the future). * User name space of control sequences is separated from internal name space - of OpTeX and primitives (`\foo` versus `\_foo`). + of \OpTeX/ and primitives (`\foo` versus `\_foo`). \enditems -\OpTeX/ should be a modern plain \TeX/ with power from OPmac (fonts selection +\OpTeX/ should be a modern Plain \TeX/ with power from OPmac (fonts selection system, colors, external graphics, references, hyperlinks, indexing, bibliography, ...) with preferred Unicode fonts. @@ -67,21 +67,25 @@ If you need to customize your document or you need to use something very specific, then you can copy relevant parts of \OpTeX/ macros into your macro file and do changes of these macros here. This is significant difference from \LaTeX/ or ConTeXt, which are an attempt to create a new user level with a -plenty of non-primitive parameters and syntax hidding \TeX/ internals. -The macros from \OpTeX/ are simple and straightforward because they solves only -what is excplicitly needed, they does not create a new user level over \TeX/. -And you can use them, understand them an modify them. +plenty of non-primitive parameters and syntax hiding \TeX/ internals. +The macros from \OpTeX/ are simple and straightforward because they solve only +what is explicitly needed, they does not create a new user level for +controlling your document over \TeX/. +And you can use \OpTeX/ macros, understand them an modify them. \OpTeX/ offers a markup language for authors of texts (like \LaTeX), -i.e. the fixed set of tags to define the structure of the document. This +i.\,e.\ the fixed set of tags to define the structure of the document. This markup is different from the \LaTeX{} markup. It may offer to write the source text of the document somewhat clearer and more attractive. \new {\bf Disclaimer:} This software is under construction. It is possible -that some features documented here will be changed in future. There exists a -large part of original OPmac macros included in \OpTeX/ which waits to its -re-implementation at current state of development. +that some features documented here will be changed in future. + +This manual desribes \OpTeX/ features only. We suppose that user knows \TeX/ +basic principles. They are described in many books. You can see a short +document \ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf] +{\TeX/ in nutshell} too. \sec Starting with \OpTeX/ @@ -111,7 +115,7 @@ The first line `\fontfam[LMfonts]` tells that Unicode Latin Modern fonts (derived from Computer Modern) are used. If you omit this line then preloaded Latin Modern fonts are used but preloaded fonts cannot be in Unicode\fnote -{This is technical limitations of \LuaTeX/ for fonts downloaded in formats: +{This is a technical limitation of \LuaTeX/ for fonts downloaded in formats: only 8bit fonts can be preloaded.}. So the sentence `Hello World` will be OK without the first line, but you cannot print such sentence in another languages (for example `Ahoj světe!`) @@ -121,11 +125,11 @@ fonts. A somewhat larger example with common settings should be: -\begtt -\fontfam[Termes] % selecting Unicode font family Termes -\typosize[11/13] % setting the basic font size and the baselineskip -\margins/1 a4 (1,1,1,1)in % setting 1in margins for A4 paper -\cslang % Czech hyphenation patterns +\begtt \catcode`!=0 +\fontfam[Termes] % selecting Unicode font family Termes (section !ref[fontfam]) +\typosize[11/13] % setting the basic font size and the baselineskip (sec. !ref[sizes]) +\margins/1 a4 (1,1,1,1)in % setting 1in margins for A4 paper (section !ref[marg]) +\cslang % Czech hyphenation patterns (section !ref[lang]) Tady je text. \bye @@ -137,15 +141,15 @@ You can look at `op-demo.tex` file for more examples. \sec Page layout %%%%%%%%%%%%%%%% -\secc Setting the margins -%%%%%%%%%%%%%%%%%%%%%%%% +\secc[marg] Setting the margins +%%%%%%%%%%%%%%%%%%%%%%%%%%%% \OpTeX/ declares paper formats a4, a4l (landscape~a4), a5, a5l, b5, letter and user can declare another own format by `\sdef`: \begtt -\sdef{pgs:b5l}{(250,176)mm} -\sdef{pgs:letterl}{(11,8.5)in} +\sdef{_pgs:b5l}{(250,176)mm} +\sdef{_pgs:letterl}{(11,8.5)in} \endtt The `\margins` command declares margins of the document. This command have @@ -182,10 +186,10 @@ parameter is empty (`\vsize` instead `\hsize` is used). Examples: If `<pg>=1` then all pages have the same margins. If `<pg>=2` then the declared margins are true for odd pages. The margins at the even pages are -mirrored in such case, it means that <left> is replaced by <right> and vice -versa. +automaticaly mirrored in such case, it means that <left> is replaced by +<right> and vice versa. -The `<fmt>` can be in the form `(<width>,<height>)<unit>` where `<unit>` is +The `<fmt>` can be also in the form `(<width>,<height>)<unit>` where `<unit>` is optional. If it is missing then `<unit>` after margins specification is used. For example: @@ -215,32 +219,34 @@ review printing. After review is done, the second line can be commented out. \secc Concept of default page %%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\OpTeX/ uses for page design very similar \"output routine" like plain +\OpTeX/ uses for page design very similar \"output routine" like Plain \TeX/. There is `\headline` followed by \"page body" followed by `\footline`. The `\headline` is empty by default and it can be used for running headers repeated on each page. The `\footline` prints -page number in the center by default. You can set the `\footline` to empty +centered page number by default. You can set the `\footline` to empty using `\nopagenumbers` macro. -The margins declared by `\margins` macro is concerned to the page body, -i.e.\ the `\headline` and `\fooline` are placed to the top and bottom +The margins declared by `\margins` macro (documented in the previous +section~\ref[marg]) is concerned to the page body, +i.e.\ the `\headline` and `\footline` are placed to the top and bottom margins. -The distance between `\headline` and the top of page body is given by -`\hedalinedist` register. The distance between bottom of page body and `\footline` is -given by `\footlinedist`. The default values are: +The distance between the `\headline` and the top of the page body is given by +`\headlinedist` register. The distance between bottom of the page body and +the `\footline` is given by `\footlinedist`. The default values are: \begtt \headline = {} \footline = {\_hss\_rmfixed \_folio \_hss} % \folio expands to page number -\headlinedist = 14pt % from baseline of \hedaline to top of page body +\headlinedist = 14pt % from baseline of \headline to top of page body \footlinedist = 24pt % from last line in pagebody to baseline of footline \endtt The page body should be divided to top insertions (floating tables and -figures), real text and footnotes. Typicaly only real text is here. +figures) followed by a real text and followed by footnotes. +Typically, only real text is here. -The `\pgbackground` tokens list is empty by default but it ca be used for +The `\pgbackground` tokens list is empty by default but it can be used for creating background of each page (colors, picture, watermark for example). The macro `\draft` uses this register and puts big text DRAFT as watermark to each page. You can try it. @@ -251,7 +257,7 @@ More about the page layout is documented in files `parameters.opm` and \secc Footnotes and marginal notes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -The plain \TeX/'s macro `\footnote` can be used as usual. But a new macro +The Plain \TeX/'s macro `\footnote` can be used as usual. But a new macro `\fnote{<text>}` is defined. The footnote mark is added automatically and it is numbered \new @@ -259,44 +265,54 @@ on each chapter from one\fnote {You can declare `\fnotenumglobal` if you want footnotes numbered in whole document from one or `\fnotenumpages` if you want footnotes numbered at each page from one. Default setting is `\fnotenumchapters`}. -The <text> is scaled by `\typoscale[800]`. -User can redefine fotnote mark or scaling, as shown in the file +The <text> is scaled to 80 \%. +User can redefine footnote mark or scaling, as shown in the file `fnotes.opm`. The `\fnote` macro is fully applicable only in \"normal outer" paragraph. It doesn't work inside boxes (tables for example). If you are solving such -case you can use `\fnotemark<number>` inside the box (only the footnote mark is -generated). When the box is finished you can use `\fnotetext{<text>}`. This -macro puts the <text> to the footnote. The <number> after `\fnotemark` -have to be "1" if only one such command is in the box. Second `\fnotemark` -inside the same box have to have the parameter `2` etc. +case you can use `\fnotemark<numeric-label>` inside the box: only the +footnote mark is generated here. When the box is finished you can use +`\fnotetext{<text>}`. This macro puts the <text> to the footnote. +The <numeric-label> have to be `1` if only one such command is in the box. +Second `\fnotemark` inside the same box have to have the parameter `2` etc. The same number of `\fnotetext`s have to be written after the box as the number of `\fnotemark`s inserted inside the box. +Example: + +\begtt +Text in a paragraph\fnote{First notice}... % a "normal" footnote +\table{...}{...\fnotemark1...\fnotemark2...} % two footnotes in a box +\fnotetext{Second notice} +\fnotetext{Third notice} +... +\table{...}{...\fnotemark1...} % one footnote in a box +\fnotetext{Fourth notice} +\endtt The marginal note can be printed by the `\mnote{<text>}` macro. The <text> is placed to the right margin on the odd pages and it is placed to the left margin on the even pages. This is done after second \TeX{} run because the -relevant information is stored in an external file. If you need to place the -notes only to the fixed margin write `\fixmnotes\right` or -`\fixmnotes\left`. +relevant information is stored in an external file and read from it again. +If you need to place the notes only to the fixed margin write +`\fixmnotes\right` or `\fixmnotes\left`. The <text> is formatted as a little paragraph with the maximal width `\mnotesize` ragged left on the left margins or ragged right on the right -margins. The first line of this little paragraph is at the same height as -the invisible mark created by `\mnote` in the current paragraph. The -exceptions are possible by `\mnoteskip` register. You can implement such -exceptions to each `\mnote` manually in final printing in order to margin -notes do not overlap. The positive value of `\mnoteskip` shifts the note up -and negative value shifts it down. For example -`\mnoteskip=2\baselineskip \mnote{<text>}` shifts this (and only this) note -two lines up. +margins. The first line of this little paragraph has its vertical position +given by the position of `\mnote` in the text. The exceptions are possible +by setting the `\mnoteskip` register. You can implement such exceptions to +each `\mnote` manually in final printing in order to margin notes do not +overlap. The positive value of `\mnoteskip` shifts the note up and negative +value shifts it down. For example `\mnoteskip=2\baselineskip \mnote{<text>}` +shifts this (and only this) note two lines up. \sec Fonts %%%%%%%%%% -\secc Font families -%%%%%%%%%%%%%%%%%%% +\secc[fontfam] Font families +%%%%%%%%%%%%%%%%%%%%%%% You can select the font family by `\fontfam[<Family-name>]`. The argument <Family-name> is case insensitive and spaces are ignored. So, @@ -306,16 +322,18 @@ to `\fontfam[lmfonts]`. Several aliases are prepared, thus If you write `\fontfam[?]` then all font families registered in \OpTeX/ are listed on the terminal and in the log file. - If you write `\fontfam[catalog]` then a catalog of all fonts registered in -\OpTeX/ and available in your \TeX/ system is printed. And the instructions +\OpTeX/ and available in your \TeX/ system is printed. The instructions how to register your own font family is appended in such catalog. If the family is loaded then {\em font modifiers} applicable in such font family are listed on the terminal: (`\caps`, `\cond` for example). And there are four basic {\em variant selectors} (`\rm`, `\bf`, `\it`, `\bi`). +The usage of variant selectors is the same as in Plain \TeX: +`{\it italics text}`, `{\bf bold text}` etc. + The font modifiers (`\caps`, `\cond` for example) can -be used immediately before a basic variant selector and they +be used before a basic variant selector and they can be (independently) combined: `\caps\it` or `\cond\caps\bf`. The modifiers keeps their internal setting until group ends or until another modifier which negates the previous feature is used. So @@ -323,14 +341,14 @@ modifier which negates the previous feature is used. So \new There is one special variant selector `\currvar` which does not change the -selected variant but reloads the font in respect of the (maybe newly -specified) font modifiers(s). +selected variant but reloads the font due to the (maybe newly +specified) font modifier(s). The context between variants `\rm`--`\it` and `\bf`--`\bi` is kept by the `\em` macro (emphasize text). It switches from current `\rm` to `\it`, from current `\it` to `\rm`, from current `\bf` to `\bi` and from current `\bi` to `\bf`. -The needed italics correction `\/` is inserted automatically. Example: +The italics correction `\/` is inserted automatically. Example: \begtt This is {\em important} text. % = This is {\it important\/} text. @@ -342,10 +360,10 @@ This is {\em important} text. % = This is {\it important\/} text. \new More about the \OpTeX/ font selection system is written the file `fonts-select.opm`. You can mix more font families in your document, you can -declare your variant selectors or modifiers etc. +declare your own variant selectors or modifiers etc. -\secc Font sizes -%%%%%%%%%%%%%%% +\secc[sizes] Font sizes +%%%%%%%%%%%%%%%%%%%%% The command `\typosize[<fontsize>/<baselineskip>]` sets the font size of text and math fonts and baselineskip. If one of these two parameters is empty, the @@ -356,7 +374,7 @@ for instance `\ptunit=1mm` enlarges all font sizes declared by `\typosize`. Examples: \begtt -\typosize[10/12] % default of plainTeX +\typosize[10/12] % default of Plain TeX \typosize[11/12.5] % font 11pt, baseline 12.5pt \typosize[8/] % font 8pt, baseline unchanged \endtt @@ -379,15 +397,15 @@ i.e. the value stays unchanged. Examples: \begtt \typoscale[800/800] % fonts and baselineskip re-size to 80 % -\typoscale[\magstep2/] % fonts bigger 1,44times +\typoscale[\magstep2/] % fonts bigger 1,44times (\magstep2 expands to 1440) \endtt First usage of `\typosize` or `\typoscale` macro in your document sets so -called {\em main values}, i.~e. main font size and main baselineskip. They are internally +called {\em main values}, i.\,e.\ main font size and main baselineskip. They are internally saved in registers `\mainfosize` and `\mainbaselineskip`. \new -The `\typoscale` comand does scaling in respect to current values by default. +The `\typoscale` command does scaling in respect to current values by default. If you want to do it in respect to main values, type `\scalemain` immediately before `\typoscale` command. @@ -403,9 +421,14 @@ The size of the current font can be changed by the command baselineskip. \new -There is `\setfontsize{<size-spec>}` command which behaves like -font modifiers and sets given font size o fonts loaded by next variant selectors. -For example `\setfontsize{at15pt}\currvar`. +There is \"low level" `\setfontsize{<size-spec>}` command which behaves like +a font modifier and sets given font size used by next variant selectors. +For example `\setfontsize{at15pt}\currvar` sets current variant to 15pt. + +If you are using a font family with \"optical sizes feature" (i.\,e.\ there +are more recommended sizes of the same font which are not scaled +linearly; good example is Computer Modern aka Latin Modern fonts) +then the recommended size is selected by all mentioned commands automatically. More information about resizing of fonts is documented in `fonts-resize.opm` file. @@ -413,18 +436,20 @@ file. \secc Typesetting math %%%%%%%%%%%%%%%%%%%%% -\OpTeX/ preloads a collection of 7bit Computer Modern and AMS fonts. -You can use them in any size and in the `\boldmath` variant. +\OpTeX/ preloads a collection of 7bit Computer Modern math fonts +and AMS fonts in its format. You can use them in any size and in the +`\boldmath` variant. % \new -Most declared font families are configured with recommended Unicode -math font. This font is automaticlally loaded unless you specify +Most declared text font families (see `\fontfam` in the section~\ref[fontfam]) +are configured with recommended Unicode +math font. This font is automaticlaly loaded unless you specify `\noloadmath` before first `\fontfam` command. See log file for more information about loading text font family and Unicode math fonts. If you prefer another Unicode math font, specify it by `\loadmath{[<font-file>]}` or `\loadmath{font-name}` before first `\loadfam` command. -Hundreds math symbols and operators like in AMS\TeX/ are accesible. +Hundreds math symbols and operators like in AMS\TeX/ are accessible. For example `\alpha` $\alpha$, `\geq`~$\geq$, `\sum` $\sum$, `\sphericalangle` $\sphericalangle$, `\bumpeq`, $\bumpeq$. See AMS\TeX/ manual for complete list of symbols. @@ -443,8 +468,10 @@ The following math alphabets are available: \bi % sans serif bold slanted $/bi abc-xyz,ABC-XYZ$ \endtt -The last two selectors `\bf` and `\bi` select the sans serif fonts regardless -current text font family. +The last two selectors `\bf` and `\bi` select the sans serif fonts in math regardless +the current text font family. This is common notation for vectors and +matrices. You can re-declare it, see the file `unimath-codes.opm` where math +variants of `\bf` and `\bi` selectors are defined. The math fonts can be scaled by `\typosize` and `\typoscale` macros. Two math fonts collections are prepared: `\normalmath` for normal weight @@ -474,16 +501,20 @@ braces are used): \secc Subsection title <end of line> \endtt -The chapters are numbered by one number, sections by two numbers +If you want to write a title to more lines in your source file then you can +use percent character before <end of line>. Such <end of line> is not +scanned and reading of the title continues at next line. + +The chapters are automatically numbered by one number, sections by two numbers (chapter.section) and subsections by three numbers. If there are no chapters then section have only one number and subsection two. The implicit design of the titles of chapter etc.\ are implemented in the -macros `\printchap`, `\printsec` and `\printsecc`. User can simply change +macros `\_printchap`, `\_printsec` and `\_printsecc`. A designer can simply change these macros if he/she needs another behavior. The first paragraph after the title of chapter, section and subsection is -not indented but you can type `\let\firstnoindent=\relax` if you need all +not indented but you can type `\let\_firstnoindent=\relax` if you need all paragraphs indented. If a title is so long then it breaks to more lines. It is better to hint the @@ -501,9 +532,9 @@ Apart from chapters, sections and subsections, there are another automatically numbered objects: equations and captions for tables and figures. -If user write the `\eqmark` as the last element of the display mode then -this equation is numbered. The format is one number in brackets. This number -is reset in each section. +If user writes the `\eqmark` as the last element of the display mode then +this equation is numbered. The equation number is printed in brackets. This number +resets in each section by default. If the `\eqalignno` is used, then user can put `\eqmark` to the last column before `\cr`. For example: @@ -514,11 +545,12 @@ before `\cr`. For example: c &= \sqrt{a^2+b^2} & \eqmark \cr} \endtt -The next numbered object is caption which is tagged by `\caption/t` for +The next automatically numbered objects are captions which is tagged by `\caption/t` for tables and `\caption/f` for figures. The caption text follows. The `\cskip` can be used between `\caption` text and the real object (table -or figure). It is irrelevant, if caption or object is first. +or figure). You can use two orders: `<caption>\cskip <object>` or +`<object>\cskip <caption>`. The `\cskip` creates appropriate vertical space between them. Example: \begtt @@ -556,12 +588,19 @@ The caption text is centered. If it occupies more lines then the last line is centered. The macro `\caption/f` behaves like `\caption/t` but it is intended for -figure captions. +figure captions with independent numbering. The word (Table, Figure) depends on the actual selected language (see section~\ref[lang] about languages). If you wish to make the table or figure as floating object, you need to use -plain \TeX/ macros `\midinsert` or `\topinsert` terminated by `\endinsert`. +Plain \TeX/ macros `\midinsert` or `\topinsert` terminated by `\endinsert`. +Example: + +\begtt +\topinsert % table and its caption is printed at the top of the current page + <caption and table> +\endinsert +\endtt \secc References %%%%%%%%%%%%%%% @@ -573,7 +612,7 @@ if optional parameter `[<label>]` is appended to `\chap`, `\sec`, `\secc`, `\caption/t`, `\caption/f` or `\eqmark`. The alternative syntax is to use `\label[<label>]` before mentioned commands (not necessarily directly -before). The reference is realized by `\ref[<label>]` or `\pgref[label]`. +before). The reference is realized by `\ref[<label>]` or `\pgref[<label>]`. Example: \begtt @@ -587,7 +626,7 @@ Example: $$ a^2 + b^2 = c^2 \eqmark $$ Now we can point to the section~\ref[beatle] on the page~\pgref[beatle] -or write about the equation~\ref[pythagoras]. Finally there +or write something about the equation~\ref[pythagoras]. Finally there is an interesting Table~\ref[comp-depend]. \endtt @@ -599,17 +638,21 @@ You can create a reference to whatever else by commands `\label[<label>]\wlabel{<text>}`. The connection between <label> and <text> is established. The `\ref[<label>]` will print <text>. +By default, labels are not printed, of course. But if you are preparing a +draft version of document, you can declare `\showlabels`. The labels +are printed at their destination places after such declaration. + \secc Hyperlinks, outlines %%%%%%%%%%%%%%%%%%%%%%%%% -If the command `\hyperlinks{<color-in>}{<color-out>}` is used at the beginning of -the file, then the following objects are hyperlinked when PDF output is used: +If the command `\hyperlinks <color-in> <color-out>` is used at the beginning of +the document, then the following objects are hyperlinked in the PDF output: \begitems * numbers generated by `\ref` or `\pgref`, * numbers of chapters, sections and subsections in the table of contents, * numbers or marks generated by `\cite` command (bibliography references), -* texts printed by `\url` command. +* texts printed by `\url` or `\ulink` commands. \enditems The last object is an external link and it is colored by @@ -648,7 +691,7 @@ An example: `\url{http://www.olsak.net}` creates \url{http://www.olsak.net}. The characters \code{\%}, `\`, `#`, `{` and `}` have to be protected by backslash in the `\url` argument, the other special characters `~`, `^`, `&` can be written as single character\fnote -{More exactly, there is the same rules as for \code{\\code} command, see +{More exactly, there are the same rules as for \code{\\code} command, see section~\ref[verbatim].}. You can insert the `\|` command in the `\url` argument as a potential breakpoint. @@ -670,12 +713,13 @@ triangle symbol after that. \new If you are using a special macro in section titles then `\outlines` macro may crash. You must declare variant of the macro for outlines case which is -expandable using `\regmacro`. See section \ref[toc] for more information +expandable. Use `\regmacro` in such case. See the section \ref[toc] for more information about `\regmacro`. The command `\insertoutline{<text>}` inserts next entry into PDF outlines at -the main level~0. This entry can be placed before table of contents (created -by `\outlines`) or after it. +the main level~0. These entries can be placed before table of contents (created +by `\outlines`) or after it. Theirs hyperlink destination is in the place +where `\insertoutline` macro is used. \secc Lists %%%%%%%%%% @@ -712,7 +756,7 @@ For example: * Finito \enditems \endtt - +% produces: \begitems @@ -727,23 +771,22 @@ produces: \enditems Another style can be defined by the command `\sdef{_item:<style>}{<text>}`. -Default item can be redefined by `\def\normalitem{<text>}`. +Default item can be set by `\defaultitem={<text>}`. The list environments can be nested. Each new level of item is indented by next multiple of `\iindent` which is set to `\parindent` by default. -The vertical space at begin and end of the environment is inserted by the -macro `\iiskip`. +More information about design of lists of items are in the `lists.opm` file. \secc Tables %%%%%%%%%%% The macro `\table{<declaration>}{<data>}` provides similar <declaration> -as in \LaTeX: you can use letters `l`, `r`, `c`, each letter declares +of tables as in \LaTeX: you can use letters `l`, `r`, `c`, each letter declares one column (aligned to left, right, center respectively). These letters can be combined by the `|` character (vertical line). Example \begtt \table{||lc|r||}{ \crl - Month & commodity & price \crli \tskip2pt + Month & commodity & price \crli \tskip2pt January & notebook & \$ 700 \cr February & skateboard & \$ 100 \cr July & yacht & k\$ 170 \crl} @@ -753,7 +796,7 @@ generates the following result: \bigskip \hfil\table{||lc|r||}{ \crl - Month & commodity & price \crli \tskip2pt + Month & commodity & price \crli \tskip2pt January & notebook & \$ 700 \cr February & skateboard & \$ 100 \cr July & yacht & k\$ 170 \crl} @@ -774,8 +817,8 @@ prefixed. For example `3c` means `ccc` or `c 3{|c}` means `c|c|c|c`. Note that spaces in the <declaration> are ignored and you can use them in order to more legibility. -The command `\cr` used in the <data> part of the table (the end row -separator) is generally known. It marks end row of the table. +The command `\cr` used in the <data> part of the table +is generally known. It marks end row of the table. Moreover \OpTeX/ defines following similar commands: \begitems @@ -803,21 +846,21 @@ too. \tabitemr={\enspace} % right material in each column \tabstrut={\strut} % strut which declares lines distance in the table \tablinespace=2pt % additional vertical space before/after horizontal lines -\vvkern=1pt % space between double vertical line -\hhkern=1pt % space between double horizontal line +\vvkern=1pt % space between lines in double vertical line +\hhkern=1pt % space between lines in double horizontal line \endtt -If you do `\tabiteml={$\enspace}\tabitemr={\enspace$}` then +Example: if you do `\tabiteml={$\enspace}\tabitemr={\enspace$}` then the `\table` acts like \LaTeX's array environment. If there is an item which spans to more than one column in the table then -`\multispan{<number>}` macro from plain \TeX{} can help you or, you can use +`\multispan{<number>}` macro from Plain \TeX{} can help you or, you can use `\mspan<number>[<declaration>]{<text>}` which spans <number> columns and formats the <text> by the -<declaration>. The <declaration> must include a declaration of right one column +<declaration>. The <declaration> must include a declaration of only one column with the same syntax as common `\table` <declaration>. If your table includes vertical rules and you want to -create continuous vertical rules by `\mspan`, then use rules +create continuous vertical rules by `\mspan`, then use rule declarators `|` only after `c`, `l` or `r` letter in `\mspan` <declaration>. The exception is only in the case when `\mspan` includes first column and the table have rules on the left side. The example of `\mspan` usage is below. @@ -834,18 +877,17 @@ into `\frame` if you need double-ruled border of the table. Example: % creates the following result: -%\bigskip \hfil\frame{\table{|c||l||r|}{\crl \mspan3[|c|]{\bf Title} \crl \noalign{\kern\hhkern}\crli first & second & third \crlli seven & eight & nine \crli}} \bigskip -The `c`, `l`, `r` and `p` are default \"<declaration> letters" but you can define +The `c`, `l`, `r` and `p` are default \"declaration letters" but you can define more such letters by `\def\_tabdeclare<letter>{<left>##<right>}`. More about it is in technical documentation in the file `table.opm`. -The rule width of tables (and implicit width of all `\vrule`s and `\hrule`s) +The rule width of tables and implicit width of all `\vrule`s and `\hrule`s can be set by the command `\rulewidth=<dimen>`. The default value given by \TeX/ is 0.4\,pt. @@ -880,8 +922,8 @@ User can change values of the `\parindent` and `\ttindent` independently. The `\begtt` command starts internal group in which the catcodes are changed. \new -Then the `\everytt` string reister is run. It is empty by default and user can -control fine behavior by it. For example the cactodes can be reset here. If +Then the `\everytt` tokens register is run. It is empty by default and user can +control fine behavior by it. For example the catcodes can be reseted here. If you need to define active character in the `\everytt`, use `\adef` as in the following example: @@ -892,11 +934,15 @@ Each occurrence of the exclamation mark will be changed to the question mark and vice versa. Really? You can try it! @ \endtt - +% The `\adef` command sets its parameter as active {\it after\/} -the body of `\everytt` is read. So you can't worry about active +the value of `\everytt` is read. So you don't have to worry about active categories. +There is an alternative to `\everytt` named `\everyintt` which is used for +in-line verbatim surrounded by an `\activettchar` or processed by the `\code` +command. + The `\everytt` is applied to all `\begtt...\endtt` environments (if it is not decared in a group). There are tips for such global `\everytt` definitions here: @@ -907,7 +953,7 @@ decared in a group). There are tips for such global `\everytt` definitions here: \endtt \new -If you want to apply a `\everytt` material only for one `\begtt...\endtt` +If you want to apply a special code only for one `\begtt...\endtt` environment then don't set any `\everytt` but put desired material at the same line where `\begtt` is. For example: @@ -921,7 +967,7 @@ The in-line verbatim surrounded by an `\activettchar` doesn't work in parameter of macros and macro definitions, especially in titles declared by `\chap`, `\sec` etc. \new -You ca use more robust command `\code{<text>}` in such +You can use more robust command `\code{<text>}` in such situations, but you must escape following characters in the <text>: `\`, `#`, `%`, braces (if the braces are unmatched in the <text>), and space or `^` (if there are more than one subsequent spaces or `^` in @@ -936,10 +982,6 @@ the <text>). Examples: \code{^\^M} ... prints ^^M, the second ^ must be escaped \endtt -There is an alternative to `\everytt` named `\everyintt` which is used for -in-line verbatim surrounded by an `\activettchar` or processed by the `\code` -command. - You can print verbatim listing from external files by `\verbinput` command. Examples: @@ -950,7 +992,7 @@ Examples: \verbinput (-) program.c % whole file is printed \verbinput (70+10) program.c % from line 70, only 10 lines printed \verbinput (+10) program.c % from the last line read, print 10 lines -\vebrinput (-5+7) program.c % from the last line read, skip 5, print 7 +\verbinput (-5+7) program.c % from the last line read, skip 5, print 7 \verbinput (+) program.c % from the last line read to the end \endtt @@ -1045,7 +1087,7 @@ linear~dependency 11, 40--50 \medskip -To do this you have to declare the parts of the words by the `/` separator. +To do this you have to declare the parts of the index entries by the `/` separator. Example: \begtt @@ -1072,10 +1114,11 @@ If you really need to insert the space into the index entry, write `~`. If the `\ii` or `\iid` command is preceded by `\iitype <letter>`, then such reference (or more references generated by one `\ii`) has specified type. -They should have different format in the index. \OpTeX/ implements -`\iitype b` and `\iitype i`. This prints the page number in bold or in -italics in the index. Default is empty index type, which prints page numbers -in normal font. See \TeX/book index as an example. +The page numbers of such references should be formatted +specially in the index. \OpTeX/ implements only `\iitype b`, `\iitype i` and +`\iitype u`. The page number in bold or in italics or underlined is printed +in the index when these types are used. Default index type is empty, which +prints page numbers in normal font. See \TeX/book index as an example. The `\makeindex` creates the list of alphabetically sorted index entries without the title of the section and without creating more columns. \OpTeX/ @@ -1107,29 +1150,28 @@ If the \ii relax `\relax` command is used then \TeX/ is relaxing. ... \iis chiquadrat {$\chi$-quadrat} \iis relax {\code{\\relax}} -... \endtt - -The `\iis <equivalent> {<text>}` creates one entry in the {\em dictionary -of the exceptions}. The sorting is done by the <equivalent> but the +% +The `\iis <equivalent> {<text>}` creates one entry in the \"dictionary +of the exceptions". The sorting is done by the <equivalent> but the <text> is printed in the index entry list. The sorting rules when `\makeindex` runs depends on the current language. -See section~\ref[lang] about lanuages selection. +See section~\ref[lang] about languages selection. \secc Bib\TeX/ing %%%%%%%%%%%%%%%% -The command `\cite[<label>]` or its variants of the type -\hbox{`\cite[<label-1>,<label-2>,...,<label-n>]`} -create the citations in the form [42] or [15,~19,~26]. +The command `\cite[<label>]` (or its variants of the type +\hbox{`\cite[<label-1>,<label-2>,...,<label-n>]`}) +creates the citation in the form [42] (or [15,~19,~26]). If `\shortcitations` is declared at the beginning of the document then continuous sequences of numbers are re-printed like this: \hbox{[3--5,~7,~9--11]}. If `\sortcitations` is declared then numbers generated by one `\cite` command are sorted upward. -If `\nonumcitations` is used then the marks instead numbers are generated +If `\nonumcitations` is declared then the marks instead numbers are generated depending on the used bib-style. For example the citations look like [Now08] or [Nowak, 2008]. @@ -1154,14 +1196,14 @@ references list: \begitems * Manually using `\bib[<label>]` commands. -* By `\usebib/<type> (<style>) <bbl-base>` command which reads `*.bib` - databases directly. +* By `\usebib/<type> (<style>) <bib-base>` command which reads `*.bib` + files directly. \enditems \new Note that another two possibilities documented in OPmac (using external Bib\TeX/ program) isn't supported because Bib\TeX/ is old program which does not -supports Unicode. And Biber seems to be not compliant with Plain \TeX. +support Unicode. And Biber seems to be not compliant with Plain \TeX. \medskip\noindent {\bf References created manually using `\bib[<label>]` command.} @@ -1184,8 +1226,8 @@ equal sign are mandatory. Example: \noindent {\bf Direct reading of `.bib` files} is possible by `\usebib` macro. -This macro reads macro package `opmac-bib.tex` (on demand) which uses the external -package `librarian.tex` by Paul Isambert. The usage is: +This macro reads and uses macro package `librarian.tex` by Paul Isambert. +The usage is: \begtt \usebib/c (<style>) <bib-base> % sorted by \cite-order (c=cite), @@ -1197,36 +1239,16 @@ package `librarian.tex` by Paul Isambert. The usage is: The <bib-base> is one or more `*.bib` database source files (separated by spaces and without extension) and the <style> is the part of the filename `bib-<style>.opm` where the formatting of the references list is -defined. Possible styles are `simple` or `iso690`. The behavior of -`opmac-bib.tex` and `opmac-bib-iso690.tex` is full documented in these files -(after `\endinput` command). - -The command `\usebib` select from database files only such bib-records which -were used in `\cite` or `\nocite` commands in your document. It means, not -all records are printed. The `\nocite` behaves as `\cite` but prints -nothing. It only tels that mentioned bib-record should be printed in -the reference list. If `\notcite[*]` is used then all records from <bib-base> +defined. \OpTeX/ supports `simple` or `iso690` styles. The behavior of +`\usebib` is documented in `usebib.opm` and `bib-iso690.opm` files in detail. + +Not all records are printed from <bib-base> files: the command `\usebib` +selects only such bib-records which were used in `\cite` or `\nocite` +commands in your document. The `\nocite` behaves as `\cite` but prints +nothing. It only tels that mentioned bib-record should be printed in the +reference list. If `\notcite[*]` is used then all records from <bib-base> are printed. -\medskip\noindent -{\bf Formatting of the references list} is controlled by the `\printb` macro. -It is called at the begin of each entry. The default `\printb` macro prints -the number of the entry in square brackets. If the `\nonumcitations` is set -then no numbers are printed, only all lines (but no first one) are indented. -The `\printb` macro can use the following values: `\the\bibnum` (the number -of the entry) and `\the\bibmark` (the mark of the entry used when -`\nonumcitations` is set). Examples: - -\begtt -% The numbers are without square brackets: -\def\printbib{\hangindent=\parindent \indent \llap{\the\bibnum. }} -% Printing of <marks> when \nonumcitations is set: -\def\printbib{\hangindent=\parindent \noindent [\the\bibmark]\quad} -\endtt - -Another examples can be found on the -\ulink[http://petr.olsak.net/opmac-tricks-e.html]{OPmac tricks WWW page}. - \sec Graphics %%%%%%%%%%%%% @@ -1246,27 +1268,39 @@ Another examples can be found on the {\Grey `\Grey`}, {\LightGrey `\LightGrey`} and `\Black`. User can define more -such selectors by setting the CMYK components. For example +such selectors by setting four CMYK components +\new +or three RGB components. For example \begtt \def \Orange {\setcmykcolor{0 0.5 1 0}} +\def \Purple {\setrgbcolor{1 0 1}} \endtt \new The command `\morecolors` reads more definitions of color selectors from \LaTeX/ file `x11nam.def`. There is about 300 color names like `\DeepPink`, `\Chocolate` etc. If there are numbered variants of the same -name, then you can apend letters B, C, etc. to the name in \OpTeX/. For example -`\Chocolate` is Chocolate1, `\ChocolateB` is Cocolate2 etc. +name, then you can append letters B, C, etc. to the name in \OpTeX/. For example +`\Chocolate` is Chocolate1, `\ChocolateB` is Chocolate2 etc. \new -The color selectors work locally in groups by default but with limitiations. See +The color selectors work locally in groups by default but with limitations. See the file `colors.opm` for more information. -Default colors are defined by four CMYK components using `\setcmykcolor` like in -the example above. But you can define a color with three RGB components too by -`\setrgbcolor`, for example `\def\Orange{\setrgbcolor{1 0.5 0}}`. All colors -defined by `\morecolors` are in RGB. +The colors `\Blue`, `\Cyan` etc. are defined with CMYK components using `\setcmykcolor`. +But you can define a color with three RGB components too and `\morecolors` +defines such RGB colors. By default, the color model isn't converted but only stored to +PDF output for each used color by default. Thus, there may be a mix of color +models in the PDF output which is not good idea. You can overcome this +problem by declaration `\onlyrgb` or `\onlycmyk`. Then only selected color +model is used for PDF output and if an used color is declared by another color +model then it is converted. +The `\onlyrgb` creates colors more bright (usable for computer +presentations). On the other hand CMYK makes colors more true\fnote +{Printed output is more equal to the monitor preview especialy if you are +using ICC profile for your printer.} +for printing. \new You can define your color by a linear combination of previously defined colors using @@ -1279,18 +1313,13 @@ You can define your color by a linear combination of previously defined colors u \colordef \MyColor {.3\Orange+.5\Green+.2\Yellow} \endtt % +The linear combination is done in CMYK substractive color space by default +(RGB colors used in `\colordef` argument are converted first). +If the resulting component is greater than 1 then it is truncated to 1. If a convex linear combination (as in the last example above) is used then it -emulates color behavior on a painter's palette. - -Only `\setcmykcolor` is used in default colors in \OpTeX/ and `\colordef` -creates also a colors defined by `\setcmykcolor`. If you define your own -colors by `\setrgbcolor` or you use `\morecolors` then a mix of color spaces -should be in the PDF output. The `\onlyrgb` or `\onlycmyk` commands solves -this problem: only specified color space is used in the -PDF output and if a color is specified in another color space then it is -converted. The `\onlyrgb` creates colors more bright (usable for computer -presentations). On the other hand CMYK makes colors more true when -they are printing. +emulates color behavior on a painter's palette. +You can use `\rgbcolordef` instead `\colordef` if you want to mix colors +in additive RGB color space. More about colors, about CMYK versus RGB and about the `\colordef` command is written in the `colors.opm` file. @@ -1313,34 +1342,42 @@ The `\coloron` can be defined as follows: \coloron\Yellow\Brown{The brown text on the yellow backround} \endtt -{\bf The watermark} is grey text on the backround of the page. \OpTeX/ offers -an example: the macro `\draft` which creates grey scaled and rotated text -DRAFT on the background of every page. - \secc Images %%%%%%%%%%% -The `\inspic <filename>.<extension><space>` or -`\inspic {<filename>.<extension>}` +The `\inspic {<filename>.<extension>}` or +`\inspic <filename>.<extension><space>` inserts the picture stored in -the graphics file with the name `<filename>.<extension>`. +the graphics file with the name `<filename>.<extension>` to the document. You can set the picture width by `\picw=<dimen>` before `\inspic` command which declares the width of the picture The image files can be in the PNG, JPG, JBIG2 or PDF format. -The `\picwidth` is an equivalent the register to `\picw`. Moreover there is an +The `\picwidth` is an equivalent register to `\picw`. Moreover there is an `\picheight` register which denotes the height of the picture. If both registers are set then the picture will be (probably) deformed. -The image files are searched in `\picdir`. This token string is empty +The image files are searched in `\picdir`. This token list is empty by default, this means that the image files are searched in the -current directory. +current directory. Example: `\picdir={img/}` supposes that image files are +in `img` subdirectory. Note: the directory name must end by `/` in `\picdir` +declaration. + +Inkscape\fnote +{A powerfull and free wysiwyg editor for creating vector graphics.} +is able to save a picture to PDF and labels of the picture to another +file\fnote +{Chose \"Omit text in PDF and create LaTeX file" option.}. +This second file should be read by \TeX/ in order to print labels +in the same font as document font. \OpTeX/ supports this feature by +`\inkinspic {<filename>.pdf}` command. It reads and displays both: PDF image +and labes generated by Inkscape. If you want to create a vector graphics (diagrams, schema, geometry -skicing) then you can do it in Wysiwyg graphics editor (Inkscape for +skicing) then you can do it in Wysiwyg graphics editor (Inkscape, Geogebra for example), export the result to PDF and include it by `\inspic`. -If you want to \"proramm" such pictures then Tikz package is recommended. -It works in plain \TeX. +If you want to \"programm" such pictures then Tikz package is recommended. +It works in Plain \TeX. \secc PDF transformations %%%%%%%%%%%%%%%%%%%%%%%% @@ -1352,8 +1389,8 @@ with the current matrix so linear transformations can be composed. One linear transformation given by the `\pdfsetmatrix` above transforms the vector $[0,1]$ to $[<a>,<b>]$ and $[1,0]$ to $[<c>,<d>]$. The stack-oriented commands `\pdfsave` and `\pdfrestore` gives a possibility of -storing and restoring the current transformation matrix and current point. -The possition of current point have to be the same from \TeX{}'s point of +storing and restoring the current transformation matrix and the current point. +The position of the current point have to be the same from \TeX{}'s point of view as from transformation point of view when `\pdfrestore` is processed. Due to this fact the `\pdfsave\rlap{<transformed text>}\pdfrestore` or something similar is recommended. @@ -1365,8 +1402,7 @@ or something similar is recommended. \pdfrotate{<angle-in-degrees>} \endtt -These macros simply calls the -properly `\pdfsetmatrix` primitive command. +These macros simply calls the properly `\pdfsetmatrix` command. It is known that the composition of transformations is not commutative. It means that the order is important. You have to read the transformation @@ -1388,7 +1424,21 @@ This gives the following result. First: \pdfsave \pdfrotate{30}\pdfscale{-2}{2}\rlap{text1}\pdfrestore second: \pdfsave \pdfscale{-2}{2}\pdfrotate{30}\rlap{text2}\pdfrestore third: \pdfsave \pdfrotate{-15.3}\pdfsetmatrix{2 0 1.5 2}\rlap{text3}\pdfrestore -\bigskip\bigskip +\par\nobreak\bigskip\penalty0%\bigskip + +You can see that \TeX/ knows nothing about dimensions of transfomed material, +it treats it as with a zero dimension object. +This problem is solved by the `\transformbox{<transformation>}{<text>}` +macro which puts the transformed +material to a box with relevant dimension. The <transfromation> parameter +includes one or more transfromation commands `\pdfsetmatrix`, `\pdfscale`, +`\pdfrotate` with their parameters. The <text> is transformed text. + +Example: `\frame{\transformbox{\pdfscale{1}{1.5}\pdfrotate{-10}}{moj}}` +creates \frame{\transformbox{\pdfscale{1}{1.5}\pdfrotate{-10}}{moj}}. + +The `\rotbox{<deg>}{<text>}` is a shortcut for +`\transformbox{\pdfrotate{<deg>}}{<text>}`. \sec Others @@ -1418,92 +1468,62 @@ macro. This macro prints now: \new For compatibility with e-plain macros, there is the command `\uselanguege{<language>}`. The parameter <language> is long form of -language name, i.e.\ `\uselanguage{Czech}` does the same work as `\cslang`. +language name, i.e.\ `\uselanguage{Czech}` works the same as `\cslang`. The `\uselanguage` parameter is case insensitive. -For compatibility with \csplain/ there are macros `\ehyph`, `\chyph`, +For compatibility with \csplain/, there are macros `\ehyph`, `\chyph`, `\shyph` which are equivalent to `\enlang`, `\cslang` and `\sklang`. You can switch between language patterns by `\<iso-code>lang` commands mentioned -above. Defalut is `\enlang`. +above. Default is `\enlang`. \OpTeX/ generates three words used for captions and titles in technical -articles or books: \"Chapter", \"Table" and \"Figure". These words need to be know -in used language and it depends on the previsously used language selectors +articles or books: \"Chapter", \"Table" and \"Figure". These words need to be known +in used language and it depends on the previously used language selectors `\<iso-code>lang`. \OpTeX/ declares these words only for few languages: \new Czech, German, Spanish, French, Greek, Italian, Polish, Russian, Slovak and English, If you need to use these words in another languages or you want to auto-generate more words in your macros, then you can declare it by -`\sdef` commands as shown in the file `languages.opm`. +`\sdef` or `\_langw` commands as shown in the file `languages.opm`. The `\makeindex` command needs to know the sorting rules used in your language. \OpTeX/ defines only few language rules for sorting: Czech, Slovak and English. How to declare sorting rules for more languages are described in the file `makeindex.opm`. -\iffalse -And you can optionally -define the `\specsortingdata<iso-code>` macro. Example: -%{\emergencystretch=2em\par} - -\begtt -\def\sortingdataes {aAäÄáÁ,bB,cCçÇ,^^P^^Q^^R,dD,...,zZ,.} -\def\specsortingdataes {ch:^^P Ch:^^Q CH:^^R} -\endtt - -There are groups of letters separated by comma and ended by comma-dot in -the parameter of the macro `\sortingdata<iso-code>`. (In the example above, three dots must -be replaced by real data by the user.) All letters in one group are not -distinguished during first step of sorting (primary sorting). If some items -are equal from this point of view then the secondary sorting is processed -for such items where all mentioned letters are distinguished in the order -given in the macro. - -Sorting algorithm can treat couple of letters (like Dz, Ch etc.) as one letter -if the parameter of the macro `\specsortingdata<iso-code>` is defined. There is -a space separated list of items in the form `<couple>:<one-token>`. The -replacing from <couple> to <one-token> is done before sorting, so you can -use `<one-token>` in the `\sortingdata<iso-code>` macro. The `<one-token>` -must be something special not used as the letter of the alphabet. The usage of -`^^A`, `^^B` etc. is recommended but you must avoid the `^^I` and `^^M` because -these characters have special catcode. - -The macros `\sortingdata<iso-code>` and `\specsortingdata<iso-code>` are -active when the language selector `\<iso-code>lang` is used. - -The list of ignored characters for sorting point of view is defined in the -`\setignoredchars` macro. \OpTeX/ defines this macro like: - -{\catcode`\<=12 -\begtt -\def\setignoredchars{\setlccodes ,.;.?.!.:.'.".|.(.).[.].<.>.=.+.{}{}} -\endtt -}% -It means that comma, semicolon, question mark, \dots, plus mark are treated -as dot and dot is ignored by sorting algorithm. You can redefine this macro, -but you must keep the format, keep `\setlccodes` in the front and `{}{}` in -the end. -\fi +If you declare `\<iso-code>quotes`, then the control sequences `\"` and `\'` +should be used like this: `\"<quoted text>"` or `\'<quoted text>'` +(note that the terminating character is the same but it isn't escaped). +This prints language dependent normal or alternative quotes around +<quoted text>. The language is specified by <iso-code>. \OpTeX/ declares +quotes only for Czech, German, Spanish, French, Greek, Italian, Polish, +Russian, Slovak and English (`\csquotes`, `\dequotes`, \dots, `\enquotes`). +You can simply define your own quotes as shown in `languages.opm` file. +The `\"` is used for quotes visualy more similar to the `"` character which +can be primary quotes or secondary quotes depending on the language rules. +May be you want to alternate meaning of these two types of quotes. Use +`\<isocode>quotes\atlquotes` in such case. \secc Pre-defined styles %%%%%%%%%%%%%%%%%%%%%%% -\OpTeX/ defines two style-declaration macros `\report` and `\letter` -You can use them at the beginning of your document if you are +\OpTeX/ defines three style-declaration macros `\report`, `\letter` and +`\slides`. You can use them at the beginning of your document if you are preparing these types of document and you don't need to create your own macros. The `\report` declaration is intended to create reports. It sets default font size to 11\,pt and `\parindent` (paragraph indentation) to 1.2\,em. -The `\tit` macro uses smaller font because we assume that \"chapter" level +The `\tit` macro uses smaller font because we assume that \"chapter level" will be not used in reports. The first page has no page number, but next pages are numbered (from number~2). Footnotes are numbered from one in whole document. The macro `\author <authors><end-line>` can be used when `\report` is declared. It prints `<authors>` in italics at center of the line. You can separate authors by `\nl` to more lines. -The `\letter` declaration is intended to create letters. It sets default +The `\letter` declaration is intended to create letters. See an example in +the file `op-letter.tex`. The `\letter` style sets default font size to 11\,pt and `\parindent` to 0\,pt. It sets half-line space between paragraphs. The page numbers are not printed. The `\subject` macro can be used, it prints the word \"Subject:" or \"Věc" (or something else @@ -1527,10 +1547,13 @@ of lines in the source file are the same as in printed output. The document. Or you can use `<prefixed text>\address...` to put `<prefixed text>` before first line of the address. -Analogical declaration macros `\book` or `\slides` are not prepared. Each -book needs an individual typographical care so you need to create specific -macros for design. And you can find an inspiration of slides in OPmac tricks -\ulink[http://petr.olsak.net/opmac-tricks-e.html\#slidy]{0017 and 0022}. +The `\slides` style ceates a simple presentation slides. See an example +in the file `op-slides.tex`. Run `optex op-slides.tex` and see the usage of +`\slides` style in the file `op-slides.pdf`. + +Analogical declaration macros `\book` is not prepared. Each book needs an +individual typographical care so you need to create specific macros for +design. \secc Lorem ipsum dolor sit %%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1545,6 +1568,17 @@ because there are 150 paragraphs with neutral text prepared for you. The `\lipsum` macro is equivalent to `\lorem`. Example `\lipsum[1-150]` prints all prepared paragraphs. +\secc Logos +%%%%%%%%%% + +\new +The control sequences for typical logos can be terminated by optional `/` +which is ignored when printing. This makes logos more legible in source file: + +\begtt +We are using \TeX/ because it is cool. \OpTeX/ is better than \LaTeX. +\endtt + \secc The last page %%%%%%%%%%%%%%%%%%% @@ -1570,14 +1604,13 @@ zero (in first \TeX/ run) or to the number of all pages in the document \new The command `\useOpTeX` (or `\useoptex`) does nothing in \OpTeX/ but it causes -an error (undefined control sequence) when another format is used. You can use it as -the first command in your document: +an error (undefined control sequence) when another format is used. You can +put it as the first command in your document: \begtt -\useOpTeX % we are using OpTeX format, no LaTeX +\useOpTeX % we are using OpTeX format, no LaTeX :) \endtt - \sec Summary %%%%%%%%%%%% @@ -1623,8 +1656,8 @@ the first command in your document: \inspic file.ext % insert a picture, extensions: jpg, png, pdf \table {rule}{data} % simple macro for the tables like in LaTeX -\fnote % footnote (local numbering on each page) -\mnote % note in the margin (left or right by page number) +\fnote {text} % footnote (local numbering on each page) +\mnote {text} % note in the margin (left or right by page number) \hyperlinks {color-in}{color-out} % PDF links activate as clickable \outlines {level} % PDF will have a table of contents in the left tab @@ -1632,20 +1665,20 @@ the first command in your document: \magscale[factor] % resize typesetting, line/page breaking unchanged \margins/pg format (left, right, top, bottom)unit % margins setting -\report \letter % style declaration macros +\report \letter \slides % style declaration macros \endtt \sec Compatibility with Plain \TeX/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -All macros of plain \TeX/ are re-written in \OpTeX/. Common macros should be -work in the same sense as in original plain \TeX. Internal control sequences +All macros of Plain \TeX/ are re-written in \OpTeX/. Common macros should +work in the same sense as in original Plain \TeX. Internal control sequences \new like `\p@` or `\f@@t` are removed and mostly replaced by control sequences prefixed by `_` (like `\_this`). All primitives and common macros have two -control sequences in prefixed and unprefixed form with the same -meaning. For example `\hbox` is equal to `\_hbox`. +control sequences with the same meaning: in prefixed and unprefixed form. +For example `\hbox` is equal to `\_hbox`. Internal macros of \OpTeX/ have and use only prefixed form. User should use unprefixed forms, but prefixed forms are accessible too, because the `_` is set as a letter category code globally (in macro files and in users document too). User @@ -1661,15 +1694,17 @@ use after the command `\fontfam[LMfonts]` which reads the fonts in OTF format. \new -The accents macros like `\'`, `\v` are undefined in \OpTeX/. Use real +The text accents macros like `\'`, `\v`, `\"` are undefined\fnote +{The math accents macros like `\acute`, `\bar`, `\dot`, `\hat` still work.} +in \OpTeX/. Use real letters like á, ř, ž in your source document instead these old accents macros. If you really want to use them, you can initialize them by `\oldaccents` command. But we don't recommend it. \new -The default paper size is not set as letter with 1\,in margins but as a4 with +The default paper size is not set as letter with 1\,in margins but as A4 with 2.5\,cm margins. You can change it, for example by -`\margins/1 letter (1,1,1,1)in`. This example sets the classical plain TeX +`\margins/1 letter (1,1,1,1)in`. This example sets the classical Plain \TeX/ page layout. \new diff --git a/macros/luatex/optex/fams-ini.opm b/macros/luatex/optex/fams-ini.opm index f9d3110f13..265150b118 100644 --- a/macros/luatex/optex/fams-ini.opm +++ b/macros/luatex/optex/fams-ini.opm @@ -1,5 +1,7 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex +% Version <2020-02-28>. Loaded in format and secondly on demand by \fontfam[catalog] + \_famtext {Special name for printing a catalogue:} \_faminfo [Catalogue] {Catalogue of all registered font families} {fonts-catalog} {} diff --git a/macros/luatex/optex/fnotes.opm b/macros/luatex/optex/fnotes.opm index 97982e7266..9f9a9d3f5e 100644 --- a/macros/luatex/optex/fnotes.opm +++ b/macros/luatex/optex/fnotes.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \fnote {Footnotes, marginal notes OpTeX <2020-03-11>} +\_codedecl \fnote {Footnotes, marginal notes OpTeX <2020-03-19>} % loaded in format \_doc ----------------------------- \begitems @@ -36,9 +36,20 @@ \endtt This code gives footnotes* and ** and*** and† etc. and it supposes that there are no more than 6 footnotes at one page. + + If you want to distinguish between footnote marks in the text and in the front of + footnote itself, then you can define `\_printfnotemarkA` and `\_printfnotemarkB`. + The following example shows an implementation of hyperlinked footnotes + (from text to footnote and bacward): + \begtt + \def\_printfnotemarkA{\ilink[fnB:\the\gfnotenum]{\_printfnotemark}\dest[fnA::\the\gfnotenum]} + \def\_printfnotemarkB{\ilink[fnA:\the\gfnotenum]{\_printfnotemark}\dest[fnB::\the\gfnotenum]} + \endtt \_cod ----------------------------- -\_def \_printfnotemark {$^{\_fnotenum}$} % default fnote mark +\_def \_printfnotemark {$^{\_fnotenum}$} % default footnote mark +\_def \_printfnotemarkA {\_printfnotemark} % footnote marks used in text +\_def \_printfnotemarkB {\_printfnotemark} % footnote marks used in front of footnotes \_doc ---------------------------- Each footnote saves the `\_Xfnote` (without parameter) to the `.ref` @@ -55,7 +66,7 @@ \_cod ---------------------------- \_def\_fnote{\_fnotemark1\_fnotetext} -\_def\_fnotemark#1{{\_advance\_gfnotenum by#1\_advance\_lfnotenum by#1\relax \_printfnotemark}} +\_def\_fnotemark#1{{\_advance\_gfnotenum by#1\_advance\_lfnotenum by#1\relax \_printfnotemarkA}} \_doc ---------------------------- The `\_fnotetext` calls `\_opfootnote` which is equivalent to plain \TeX/ @@ -76,7 +87,7 @@ \_ifpgfnote \_ifcsname _fn:\_the\_gfnotenum \_endcsname \_else \_opwarning{unknown \_noexpand\fnote mark. TeX me again} \_fi\_fi - \_opfootnote\_fnset\_printfnotemark + \_opfootnote\_fnset\_printfnotemarkB } \_def\_fnset{\_everypar={}\_the\_everyfnote \_scalemain \_typoscale[800/800]} diff --git a/macros/luatex/optex/fonts-catalog.opm b/macros/luatex/optex/fonts-catalog.opm index f9cd2af6df..de45dd3dcf 100644 --- a/macros/luatex/optex/fonts-catalog.opm +++ b/macros/luatex/optex/fonts-catalog.opm @@ -1,5 +1,7 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex +\_codedecl \_undefined {Font catalogue <2020-02-26>} % loaded on demand by \fontfam[catalog] + \_initunifonts \_begingroup diff --git a/macros/luatex/optex/fonts-opmac.opm b/macros/luatex/optex/fonts-opmac.opm index c7a8338995..20d6d45bf3 100644 --- a/macros/luatex/optex/fonts-opmac.opm +++ b/macros/luatex/optex/fonts-opmac.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \typosize {Font managing macros from OPmac <2019-05-21>} +\_codedecl \typosize {Font managing macros from OPmac <2020-02-29>} % loaded in format \_protected\_def \_typosize [#1/#2]{% \_textfontsize{#1}\_mathfontsize{#1}\_setbaselineskip{#2}% diff --git a/macros/luatex/optex/fonts-preload.opm b/macros/luatex/optex/fonts-preload.opm index 704b665e9b..49b1f226e2 100644 --- a/macros/luatex/optex/fonts-preload.opm +++ b/macros/luatex/optex/fonts-preload.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \rm {Latin Modern fonts (EC) preloaded <2020-01-23>} +\_codedecl \rm {Latin Modern fonts (EC) preloaded <2020-01-23>} % loaded in format % Only few text fonts are preloaded: diff --git a/macros/luatex/optex/fonts-resize.opm b/macros/luatex/optex/fonts-resize.opm index 15f06661ff..dbc5974852 100644 --- a/macros/luatex/optex/fonts-resize.opm +++ b/macros/luatex/optex/fonts-resize.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \setfontsize {Font resizing macros <2020-02-14>} +\_codedecl \setfontsize {Font resizing macros <2020-03-17>} % preloaded in format %% resizefont variant-name \fontswitch, for example \resizefont{bf}\_tenbf @@ -81,7 +81,7 @@ % \fontdef \new {\<modifiers>\<var-selector>} \_def \_fontdef #1#2{\_begingroup \_ifx\_fontselector\_undefined \_def\_fontselector{#1}\_fi - #2% + \_reloading #2% \_ea \_keepmeaning \_fontselector \_endgroup } \_def\_fontlet#1#2{\_ifx #2=\_ea\_fontlet \_ea#1\_else diff --git a/macros/luatex/optex/fonts-select.opm b/macros/luatex/optex/fonts-select.opm index da01089333..eaadc0dedc 100644 --- a/macros/luatex/optex/fonts-select.opm +++ b/macros/luatex/optex/fonts-select.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \fontfam {Fonts selection system <2020-02-14>} +\_codedecl \fontfam {Fonts selection system <2020-03-18>} % preloaded in format \_def\_initunifonts {% \_ea\_newcount \_csname e@alloc@attribute@count\_endcsname @@ -10,12 +10,15 @@ require('luaotfload-main') local _void = luaotfload.main () }% \_gdef\_rfskipatX ##1" ##2\_relax{"##1"}% - \_gdef\_doresizefont ##1{\_logfont{##1}% - \_ifx\_fontnamegen\_undefined \_doresizetfmfont##1\_else - \_font##1={\_fontnamegen} \_sizespec \_relax \_setwsp##1\_relax - \_fi}% - \_global\_let\_initunifonts=\_relax % we need not to do this work twice - \_global\_let\initunifonts=\_relax + \_global\_let \_doresizefont=\_doresizeunifont + \_gdef\_tryloadtt {\_fontdef\_tentt{\def\_fontnamegen{[lmmono10-regular]}\_rm}}% + \_global\_let \_initunifonts=\_relax % we need not to do this work twice + \_global\_let \initunifonts=\_relax +} +\_gdef\_doresizeunifont #1{\_logfont{#1}% + \_ifx\_fontnamegen\_undefined \_doresizetfmfont#1\_else + \_font#1={\_fontnamegen} \_sizespec \_relax \_setwsp#1\_relax + \_fi } \_def\_fontdecl [#1]#2#3#4#5#6#7{% \_initunifonts \_uniaccents @@ -108,7 +111,7 @@ \_else \_protected\_edef #1{\noexpand\_famdepend\noexpand#1{_f:\noexpand\_currfamily:\_tmp}}% \_sdef{_f:\_currfamily:\_tmp}{#3#2}% - \_def#3{\_fontdef#2{\_reloading#4}}% + \_def#3{\_fontdef#2{#4}}% \_ifx#1\tt \addto#1{\_fam\_ttfam}\fi \_sdef{_currvar:\csstring#2}{#1}% \_fi diff --git a/macros/luatex/optex/graphics.opm b/macros/luatex/optex/graphics.opm index 2ce9ba7634..d4a868a3d1 100644 --- a/macros/luatex/optex/graphics.opm +++ b/macros/luatex/optex/graphics.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \inspic {Graphics <2020-02-29>} +\_codedecl \inspic {Graphics <2020-03-18>} % preloaded in format \_doc ----------------------------- `\inspic` accepts old syntax `\inspic <filename><space>` @@ -14,18 +14,58 @@ write `\moveright\inspic ...` or something similar. \_cod \_fin ----------------------- -\_def\_inspic{\hbox\bgroup\_isnextchar\_bgroup\_inspicB\_inspicA} +\_def\_inspic{\_hbox\_bgroup\_isnextchar\_bgroup\_inspicB\_inspicA} \_def\_inspicA #1 {\_inspicB {#1}} \_def\_inspicB #1{% \_pdfximage \_ifdim\_picwidth=0pt \_else width\_picwidth\_fi \_ifdim\_picheight=0pt \_else height\_picheight\_fi \_picparams {\_the\_picdir#1}% - \_pdfrefximage\_pdflastximage\egroup} + \_pdfrefximage\_pdflastximage\_egroup} \_def\_picparams{} \_public \inspic ; + \_doc ----------------------------- + Inkscape is able to save a picture to `*.pdf` file and labels for the ficture + to `*.pdf_tex` file. The second file is in \LaTeX/ format and it is intended to read + immediately it after `*.pdf` in included in order to place labels of this ficture in + the same font as document is printed. + We need to read this \LaTeX/ file by plain \TeX/ macros when `\inkinspic` is used. + These macros are stored in the `\_inkdefs` toknes list and it is used + localy in the group. The solution is borrowed from OPmac trick 0032. + \_cod ----------------------------- + +\_def\_inkinspic{\_hbox\_bgroup\_isnextchar\_bgroup\_inkinspicB\_inkinspicA} +\_def\_inkinspicA #1 {\_inkinspicB {#1}} +\_def\_inkinspicB #1{% + \_ifdim\_picwidth=0pt \_setbox0=\_hbox{\_inspic{#1}}\_picwidth=\_wd0 \_fi + \_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\_inkscanpage#1page=#2,#3\_end{\_ifx,#2,\_else\_def\_picparams{page#2}\_fi}% + \_def\put(#1,#2)#3{\_nointerlineskip\_vbox to0pt{\_vss\_hbox to0pt{\_kern#1\_picwidth + \_pdfsave\_hbox to0pt{#3}\_pdfrestore\_hss}\_kern#2\_picwidth}}% + \_def\begin#1{\_csname _begin#1\_endcsname}% + \_def\_beginpicture(#1,#2){\_vbox\_bgroup + \_hbox to\_picwidth{}\_kern#2\_picwidth \_def\end##1{\_egroup}}% + \_def\_begintabular[#1]#2#3\end#4{% + \_vtop{\_def\\{\_cr}\_tabiteml{}\_tabitemr{}\_table{#2}{#3}}}% + \_def\color[#1]#2{\_scancolor #2,}% + \_def\_scancolor#1,#2,#3,{\_pdfliteral{#1 #2 #3 rg}}% + \_def\makebox(#1)[#2]#3{\_hbox to0pt{\_csname _mbx:#2\_endcsname{#3}}}% + \_sdef{_mbx:lb}#1{#1\_hss}\_sdef{_mbx:rb}#1{\_hss#1}\_sdef{_mbx:b}#1{\_hss#1\_hss}% + \_sdef{_mbx:lt}#1{#1\_hss}\_sdef{_mbx:rt}#1{\_hss#1}\_sdef{_mbx:t}#1{\_hss#1\_hss}% + \_def\rotatebox#1#2{\_pdfrotate{#1}#2}% + \_def\lineheight#1{}% + \_def\setlength#1#2{}% +} +\_public \inkinspic ; + \_doc ---------------------------- `\pdfscale` and `\pdfrotate` macros are implemented by `\pdfsetmatrix` primitive. or rotating we need to knos values of sin, cos function. @@ -44,6 +84,104 @@ \_public \pdfscale \pdfrotate ; -\_endcode % ------------------------------------- + \_doc ----------------------------- + The `\transformbox` is copied from OPmac trick 0046. The `\rotbox` is a + combination of `\rotsimple` from OPmac trick 0101 and `\transformbox`. + Note, that `\rotbox{-90}` puts the rotated text to the height of the outer + box (depth is zero) because code from `\rotsimple` is precessed. + But `\rotbox{-90.0}` puts the rotated text to + the depth of the outer box (height is zero) because `\transformbox` is + processed. + \_cod ----------------------------- + +\_def\_multiplyMxV #1 #2 #3 #4 {% matrix * (vvalX, vvalY) + \_tmpdim = #1\_vvalX \_advance\_tmpdim by #3\_vvalY + \_vvalY = #4\_vvalY \_advance\_vvalY by #2\_vvalX + \_vvalX = \_tmpdim +} +\_def\_multiplyMxM #1 #2 #3 #4 {% currmatrix := currmatrix * matrix + \_vvalX=#1pt \_vvalY=#2pt \_ea\_multiplyMxV \_currmatrix + \_edef\_tmpb{\_ea\_ignorept\_the\_vvalX\_space \_ea\_ignorept\_the\_vvalY}% + \_vvalX=#3pt \_vvalY=#4pt \_ea\_multiplyMxV \_currmatrix + \_edef\_currmatrix{\_tmpb\_space + \_ea\_ignorept\_the\_vvalX\_space \_ea\_ignorept\_the\_vvalY\_space}% +} +\_def\_transformbox#1#2{\_hbox{\_setbox0=\_hbox{{#2}}% + \_dimendef\_vvalX 11 \_dimendef\_vvalY 12 % we use these variables + \_dimendef\_newHt 13 \_dimendef\_newDp 14 % only in this group + \_dimendef\_newLt 15 \_dimendef\_newRt 16 + \_preptransform{#1}% + \_kern-\_newLt \_vrule height\_newHt depth\_newDp width0pt + \_setbox0=\_hbox{\_box0}\_ht0=0pt \_dp0=0pt + \_pdfsave#1\_rlap{\_box0}\_pdfrestore \_kern\_newRt}% +} +\_def\_preptransform #1{\_def\_currmatrix{1 0 0 1 }% + \_def\_pdfsetmatrix##1{\_edef\_tmpb{##1 }\_ea\_multiplyMxM \_tmpb\_unskip}% + \_let\pdfsetmatrix=\_pdfsetmatrix #1% + \_setnewHtDp 0pt \_ht0 \_setnewHtDp 0pt -\_dp0 + \_setnewHtDp \_wd0 \_ht0 \_setnewHtDp \_wd0 -\_dp0 + \_protected\_def \_pdfsetmatrix {\_pdfextension setmatrix}% + \_let\pdfsetmatrix=\_pdfsetmatrix +} +\_def\_setnewHtDp #1 #2 {% + \_vvalX=#1\_relax \_vvalY=#2\_relax \_ea\_multiplyMxV \_currmatrix + \_ifdim\_vvalX<\_newLt \_newLt=\_vvalX \_fi \_ifdim\_vvalX>\_newRt \_newRt=\_vvalX \_fi + \_ifdim\_vvalY>\_newHt \_newHt=\_vvalY \_fi \_ifdim-\_vvalY>\_newDp \_newDp=-\_vvalY \_fi +} + +\_def\_rotbox#1#2{% + \_isequal{90}{#1}\_iftrue \_rotboxA{#1}{\_kern\_ht0 \_tmpdim=\_dp0}{\_vfill}{#2}% + \_else \_isequal{-90}{#1}\_iftrue \_rotboxA{#1}{\_kern\_dp0 \_tmpdim=\_ht0}{}{#2}% + \_else \_transformbox{\_pdfrotate{#1}}{#2}% + \_fi \_fi +} +\_def\_rotboxA #1#2#3#4{\_hbox{\_setbox0=\hbox{{#4}}#2% + \_vbox to\_wd0{#3\_wd0=0pt \_dp0=0pt \_ht0=0pt + \_pdfsave\_pdfrotate{#1}\_box0\_pdfrestore\vfil}% + \_kern\_tmpdim +}} +\_public \transformbox \rotbox ; + \_doc --------------------------- + The `\_scantwodimens` scans two objects with the syntactic rule <dimen> + and returns `{<number>}{<number>}` in sp unit. + + The `\puttext <down> <right>{<text>}` puts the <text> to desired place: + From current point moves <down> and <right>, puts the <text> and returns + back. The cuuren tpoint is unchanged after this macro ends. + + The `\putpic <down> <right> <width> <height> {<image-file>}` + does `\puttext` with the image scaled to desired <width> and <height>. + If <with> or <height> is zero, natural dimension is used. + The `\nospec` is a shortcut to such natural dimension. + \_cod --------------------------- + +\_def\_scantwodimens{% + \_directlua{tex.print(string.format('{\_pcent d}{\_pcent d}', + token.scan_dimen(),token.scan_dimen{}))}% +} + +\_def\_puttext{\_ea\_ea\_ea\_puttextA\_scantwodimens} +\_def\_puttextA#1#2#3{\_setbox0=\_hbox{{#3}}\_dimen1=#1sp \_dimen2=#2sp \_puttextB} +\_def\_puttextB{% + \_ifvmode + \_ifdim\_prevdepth>0pt \_vskip-\_prevdepth \_relax \_fi + \_nointerlineskip + \_fi + \_wd0=0pt \_ht0=0pt \_dp0=0pt + \_vbox to0pt{\_kern\_dimen1 \_hbox to0pt{\_kern\_dimen2 \_box0\_hss}\_vss}} + +\_def\_putpic{\_ea\_ea\_ea\_putpicA\_scantwodimens} +\_def\_putpicA#1#2{\_dimen1=#1sp \_dimen2=#2sp \_ea\_ea\_ea\_putpicB\_scantwodimens} +\_def\_putpicB#1#2#3{\_setbox0=\_hbox{\_picwidth=#1sp \_picheight=#2sp \_inspic{#3}}\_puttextB} + +\_newbox\_bgbox +\_def\_backgroundpic#1{% + \_setbox\_bgbox=\_hbox{\_picwidth=\_pdfpagewidth \_picheight=\_pdfpageheight \_inspic{#1}}% + \_pgbackground={\_copy\_bgbox} +} +\_def\nospec{0pt} +\_public \puttext \putpic \backgroundpic ; + +\_endcode % ------------------------------------- diff --git a/macros/luatex/optex/hyperlinks.opm b/macros/luatex/optex/hyperlinks.opm index 1cf48ac945..02b33600bd 100644 --- a/macros/luatex/optex/hyperlinks.opm +++ b/macros/luatex/optex/hyperlinks.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \ulink {Hyperlinks <2020-02-22>} +\_codedecl \ulink {Hyperlinks <2020-03-15>} % preloaded in format \_newcount \_tocrefnum @@ -73,8 +73,8 @@ \_cod ---------------------------- \_def\_pdfborder#1{\_if^#1^\_else \_isdefined{#1border}\_iftrue - \_if^\_csname#1border\_endcsname^\_else - attr{/C[\_csname#1border\_endcsname] /Border[0 0 .6]}\_fi + \_if^\_csname #1border\_endcsname^\_else + attr{/C[\_csname #1border\_endcsname] /Border[0 0 .6]}\_fi \_else attr{/Border[0 0 0]}\_fi\_fi } diff --git a/macros/luatex/optex/hyphen-lan.opm b/macros/luatex/optex/hyphen-lan.opm index 0dbdf181fb..d8d035a7e0 100644 --- a/macros/luatex/optex/hyphen-lan.opm +++ b/macros/luatex/optex/hyphen-lan.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \langlist {Initialization of hypenation patterns <2019-05-21>} +\_codedecl \langlist {Initialization of hypenation patterns <2020-03-10>} % preloaded in format \_doc ----------------------------- The <iso-code> means a shortcut of language name (mostly by ISO 639-1). diff --git a/macros/luatex/optex/if-macros.opm b/macros/luatex/optex/if-macros.opm index d0423e5911..5e56503bd8 100644 --- a/macros/luatex/optex/if-macros.opm +++ b/macros/luatex/optex/if-macros.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \newif {Special if-macros, is-macros and loops <2020-01-23>} +\_codedecl \newif {Special if-macros, is-macros and loops <2020-02-27>} % preloaded in format \_doc ---------------------------- The `\newif` macro works like in plain \TeX. It means that diff --git a/macros/luatex/optex/languages.opm b/macros/luatex/optex/languages.opm index b4d6f57d2a..5bfa2febdc 100644 --- a/macros/luatex/optex/languages.opm +++ b/macros/luatex/optex/languages.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \_mtext {Languages <2020-02-14>} +\_codedecl \_mtext {Languages <2020-03-15>} % preloaded in format \_doc ----------------------------- Only three words are generated by \OpTeX/ macros: \"Chapter", @@ -69,7 +69,44 @@ \_def\_today{\_mtext{today}} \_public \today ; + \_doc ----------------------------- + Quotes should be tagged by `\"<text>"` and `\'<text>'` if `\<iso-code>quotes` + is declared at beginning of the document. If not, then the control + sequences `\"` and `\'` are undefined. Remember, that they are used in + another meaning when `\oldaccents` command is used. + The macros `\"` and `\'` are not defined as `\protected` because we need + their expansion when `\outlines` are created. + User can declare quotes by `\quoteschars<clqq><crqq><clq><crq>`, where + <clqq>...<crqq> are normal quotes and <clq>...<crq> are alternative quotes. + or use `\altquotes` to swap between meaning of these two types of quotes. + \_cod ----------------------------- -\_endcode % ------------------------------------- +\_def \_enquotes {\_quoteschars “”‘’} +\_def \_csquotes {\_quoteschars „“‚‘} +\_def \_frquotes {\_quoteschars “”«»} +\_let \_plquotes = \_frquotes +\_let \_esquotes = \_frquotes +\_let \_grquotes = \_frquotes +\_let \_ruquotes = \_frquotes +\_let \_itquotes = \_frquotes +\_let \_skquotes = \_csquotes +\_let \_dequotes = \_csquotes +\_def \_quoteschars #1#2#3#4{\_def\_altquotes{\_quoteschars#3#4#1#2}\_public\altquotes;% + \_def \"##1"{#1##1#2}\_def \'##1'{#3##1#4}} + \_doc ----------------------------- + Sometimes should be usable to leave the markup `"such"` or `'such'` i.e.~without + the first backslash. Then you can make the characters `"` and `'` active + by `\activequotes` macro and leave quotes without first backsash. + First, delare `\<iso-code>quotes`, then `\altwquotes` (if needed) and finally + `\activequotes`. + \_cod ----------------------------- + +\def\_activequotes{\_ea\_activequotesA\"""\_ea\_activequotesA\'''} +\def\_activequotesA#1#2#3{\_bgroup\_lccode`\~=`#3\_lowercase{\_egroup\_adef#3##1~{#1##1#2}}} + +\_public \quoteschars \activequotes \enquotes \csquotes \skquotes \frquotes \plquotes + \esquotes \grquotes \ruquotes \itquotes \dequotes ; + +\_endcode % ------------------------------------- diff --git a/macros/luatex/optex/lists.opm b/macros/luatex/optex/lists.opm index 0b63409dce..adc28a3617 100644 --- a/macros/luatex/optex/lists.opm +++ b/macros/luatex/optex/lists.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \begitems {Lists: begitems, enditems <2020-03-14>} +\_codedecl \begitems {Lists: begitems, enditems <2020-03-18>} % preloaded in format \_doc ----------------------------- `\aboveliskip` is used above the list of items, @@ -32,6 +32,7 @@ \_itemnum=0 \_adef*{\_startitem} \_advance\_leftskip by\_iindent \_printitem=\_defaultitem + \_the\_everybegitems } \_def\_enditems{\_par\_egroup\_belowliskip} @@ -58,7 +59,7 @@ \_sdef{_item:I}{\_uppercase\_ea{\_romannumeral\_itemnum}\_kern.5em} \_sdef{_item:a}{\_athe\_itemnum) } \_sdef{_item:A}{\_uppercase\_ea{\_athe\_itemnum}) } -\_sdef{_item:x}{\_raise.3ex\_fullrectangle{.6ex} } +\_sdef{_item:x}{\_raise.3ex\_fullrectangle{.6ex}\_kern.4em} \_sdef{_item:X}{\_raise.2ex\_fullrectangle{1ex}\_kern.5em} \_doc ----------------------------- diff --git a/macros/luatex/optex/logos.opm b/macros/luatex/optex/logos.opm index 4465d56e9b..59f1cd87f1 100644 --- a/macros/luatex/optex/logos.opm +++ b/macros/luatex/optex/logos.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \TeX {Logos TeX, LuaTeX, etc. <2019-05-21>} +\_codedecl \TeX {Logos TeX, LuaTeX, etc. <2020-02-28>} % preloaded in format \_doc ---------------------------- Despite plain \TeX/ each macro for logos ends by `\ignoreslash`. diff --git a/macros/luatex/optex/luatex-ini.opm b/macros/luatex/optex/luatex-ini.opm index 872d808ee9..315836cab1 100644 --- a/macros/luatex/optex/luatex-ini.opm +++ b/macros/luatex/optex/luatex-ini.opm @@ -1,6 +1,6 @@ -%% This is part of SpTeX project, see http://petr.olsak.net/optex +%% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \pdfprimitive {LuaTeX initialization code <2020-01-23>} +\_codedecl \pdfprimitive {LuaTeX initialization code <2020-02-21>} % preloaded in format \_let\_pdfpagewidth \pagewidth \_let\_pdfpageheight \pageheight diff --git a/macros/luatex/optex/makeindex.opm b/macros/luatex/optex/makeindex.opm index eae300dfba..5f13f5ca5a 100644 --- a/macros/luatex/optex/makeindex.opm +++ b/macros/luatex/optex/makeindex.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \makeindex {Makeindex and sorting <2020-02-14>} % loaded in format +\_codedecl \makeindex {Makeindex and sorting <2020-03-16>} % loaded in format \_doc ----------------------------- `\makeindex` implements sorting algorithm at \TeX/ macrolanguage level. @@ -104,9 +104,12 @@ \_ea\_let \_ea\_sortingdata \_csname _sortingdata\_sortinglang\endcsname \_ea\_let \_ea\_compoundchars \_csname _compoundchars\_sortinglang\endcsname \_ea\_let \_ea\_ignoredchars \_csname _ignoredchars\_sortinglang\endcsname - \_ifx \_sortingdata\_relax \_let \_sortingdata = \_sortingdataen \fi - \_ifx \_compoundchars\_relax \_let \_compoundchars = \_compoundcharsen \fi - \_ifx \_ignoredchars\_relax \_let \_ignoredchars = \_ignoredcharsen \fi + \_ifx \_sortingdata\_relax \_addto\_nold{ sortingdata}% + \_let \_sortingdata = \_sortingdataen \fi + \_ifx \_compoundchars\_relax \_addto\_nold{ compoundchars}% + \_let \_compoundchars = \_compoundcharsen \fi + \_ifx \_ignoredchars\_relax \_addto\_nold{ ignoredchars}% + \_let \_ignoredchars = \_ignoredcharsen \fi \_ifx \_compoundchars\_empty \_else \_edef \_compoundchars {\_detokenize\_ea{\_compoundchars} }\_fi % all must be catcode 12 \_def \_act ##1{\_ifx##1\_relax \_else @@ -247,7 +250,8 @@ \_newifi \_ifasciisorting \_asciisortingfalse \_def\_dosorting #1{% \begingroup - \_ifx\_sotringlang\_undefined \_edef\_sortinglang{\_cs{_lan:\_the\_language}}\_fi + \_def\_nold{}% + \_ifx\_sotringlang\_undefined \_edef\_sortinglang{\_cs{_lan:\_the\_language}}\_fi \_ifasciisorting \_edef\_sortinglang{ASCII}% \_def \_preparesorting##1{\_edef\_tmpb{\_ea\_ignorefirst\_csstring##1}}% @@ -256,6 +260,7 @@ \_setprimarysorting \_fi \_message{OpTeX: Sorting \_string#1 (\_sortinglang) ...^^J}% + \_ifx\_nold\_empty\_else \_opwarning{Missing\_nold\_space for language (\_sortinglang)}\_fi \_def \_act##1{\_preparesorting ##1\_edef##1{\_tmpb}}% \_ea\_xargs \_ea\_act #1;% \_def \_act##1{\_addto #1{##1,}}% @@ -268,7 +273,7 @@ \_doc ----------------------------- The `\makeindex` prints the index. First, it sorts the `\_iilist` second, it prints the sorted `\_iilist`, each item is printed - using `\_printiitem`. + using `\_printindexitem`. \_cod ----------------------------- \_def\_makeindex{\_par @@ -295,7 +300,7 @@ \_ifcsname _\_csstring #1\_endcsname \_ea\_ea\_ea \_printii \_csname _\_csstring #1\_endcsname &% \_else - \_ea\_printii \_ea\_ignorefirst \_csstring #1&% + \_ea\_ea\_ea\_printii \_ea\_ignorefirst \_csstring #1&% \_fi \_ea\_printiipages #1& } @@ -305,16 +310,27 @@ words in the form `<main-word>/<sub-word>/<sub-sub-word>`. The `\everyii` tokens register is applied before `\noindent`. User can declare something special here. + + The `\_newiiletter{<letter>}` macro is empty by default. It is invoked if first + letter of index entries is changed. You can declare a design between + index entries here. You can try, for example: + \begtt + \def\_newiiletter#1#2{\bigskip\hbox{\setfontsize{at15pt}\bf\uppercase{#1}}\medskip} + \endtt \_cod ----------------------------- -\_def\_printii #1&{\_gdef\_currii{#1}\_the\_everyii\_noindent - \_hskip-\_iindent \_ignorespaces\_printiiA#1//} +\_def\_printii #1#2&{% + \_ismacro\_lastii{#1}\_iffalse \_newiiletter{#1}{#2}\_def\_lastii{#1}\_fi + \_gdef\_currii{#1#2}\_the\_everyii\_noindent + \_hskip-\_iindent \_ignorespaces\_printiiA#1#2//} \_def\_printiiA #1/{\_if^#1^\_let\_previi=\_currii \_else \_ea\_scanprevii\_previi/&\_edef\_tmpb{\_detokenize{#1}}% \_ifx\_tmpa\_tmpb \_iiemdash \_else#1 \_gdef\_previi{}\_fi \_expandafter\_printiiA\_fi } \_def\_iiemdash{\_kern.1em---\_space} +\_def\_lastii{} +\_def\_newiiletter#1#2{} \_def\_scanprevii#1/#2&{\_def\_previi{#2}\_edef\_tmpa{\_detokenize{#1}}} \_def\_previi{} % previous index item @@ -362,12 +378,14 @@ \_cod ----------------------------- \_def\_pgprint #1:#2{% - \_ifx,#2,\_pgprintA{#1}\_returnfi \_fi + \_ifx ,#2,\_pgprintA{#1}\_returnfi \_fi \_ifx b#2{\_bf \_pgprintA{#1}}\_returnfi \_fi - \_ifx i#2{\_it \_pfprintA{#1}}\_returnfi \_fi + \_ifx i#2{\_it \_pgprintA{#1}}\_returnfi \_fi + \_ifx u#2\_pgu{\_pgprintA{#1}}\_returnfi \_fi \_pgprintA{#1}\_relax } \_def\_pgprintA #1{\_ilink[pg:#1]{\_cs{_pgi:#1}}} % \ilink[pg:<gpageno>]{<pageno>} +\_def\_pgu#1{\_leavevmode\_vtop{\_hbox{#1}\kern.3ex\_hrule}} \_doc ----------------------------- The `\iindex{<word>}` puts one <word> to the index. It writes diff --git a/macros/luatex/optex/maketoc.opm b/macros/luatex/optex/maketoc.opm index 6589c66f72..6ab711657e 100644 --- a/macros/luatex/optex/maketoc.opm +++ b/macros/luatex/optex/maketoc.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \maketoc {Macros for maketoc <2020-02-14>} +\_codedecl \maketoc {Macros for maketoc <2020-03-12>} % preloaded in format \_doc ------------------------------------ `\_Xtoc{<level>}{<type>}{<number>}{<text>}` (in `.ref` file) reads the diff --git a/macros/luatex/optex/margins.opm b/macros/luatex/optex/margins.opm index 9503bc3940..72c769f672 100644 --- a/macros/luatex/optex/margins.opm +++ b/macros/luatex/optex/margins.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \margins {Macros for margins setting <2019-05-21>} +\_codedecl \margins {Macros for margins setting <2020-03-14>} % preloaded in format \_newdimen\_pgwidth \_newdimen\_pgheight \_pgwidth=0pt \_newdimen\_shiftoffset @@ -65,8 +65,8 @@ OPmac declares paper formats a4, a4l (landscape~a4), a5, a5l, b5, letter and user can declare another own format by "\sdef": \begtt -\sdef{pgs:b5l}{(250,176)mm} -\sdef{pgs:letterl}{(11,8.5)in} +\sdef{_pgs:b5l}{(250,176)mm} +\sdef{_pgs:letterl}{(11,8.5)in} \endtt The "\margins" command declares margins of the document. This command have diff --git a/macros/luatex/optex/math-macros.opm b/macros/luatex/optex/math-macros.opm index ebd32fe214..6ad97618ff 100644 --- a/macros/luatex/optex/math-macros.opm +++ b/macros/luatex/optex/math-macros.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \sin {Math macros plus mathchardefs <2020-02-14>} +\_codedecl \sin {Math macros plus mathchardefs <2020-03-14>} % preloaded in format %% The character _ as subscript prefix: diff --git a/macros/luatex/optex/math-preload.opm b/macros/luatex/optex/math-preload.opm index 8ced2c1cc0..5251f09424 100644 --- a/macros/luatex/optex/math-preload.opm +++ b/macros/luatex/optex/math-preload.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \normalmath {Math fonts CM + AMS preloaded <2020-01-23>} +\_codedecl \normalmath {Math fonts CM + AMS preloaded <2020-02-25>} % preloaded in format % Only few text fonts are preloaded: diff --git a/macros/luatex/optex/math-unicode.opm b/macros/luatex/optex/math-unicode.opm index cf800ca540..fe823b96f4 100644 --- a/macros/luatex/optex/math-unicode.opm +++ b/macros/luatex/optex/math-unicode.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \loadmath {Unicode Math fonts <2020-02-14>} +\_codedecl \loadmath {Unicode Math fonts <2020-02-25>} % preloaded in format \_newifi \_ifmathloading \_mathloadingtrue diff --git a/macros/luatex/optex/op-macros.opm b/macros/luatex/optex/more-macros.opm index 4cbb923b4c..4f4c4d113b 100644 --- a/macros/luatex/optex/op-macros.opm +++ b/macros/luatex/optex/more-macros.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \eoldef {OpTeX useful macos <2020-02-14>} +\_codedecl \eoldef {OpTeX useful macos <2020-03-15>} % preloaded in format \_newcatcodetable \_optexcatcodes \_savecatcodetable\_optexcatcodes @@ -88,8 +88,6 @@ \def\catcode{\_catcode\_string} % more robust in cases \catcode` or \catcode" -\_def\_enquotes{\_chardef\"="201C } % use \"text" for English quotes - % \removespaces text with spaces {} -> textwithspaces \_def\_removespaces #1 {\_isempty{#1}\_iffalse #1\_ea\_removespaces\_fi} @@ -126,7 +124,7 @@ \public \setctable \restorectable \normalcatodes \opt \optdef \eoldef \bracedparam \replstring - \keepinputnames \lastinputname \enquotes \removespaces \trycs + \keepinputnames \lastinputname \removespaces \trycs \ignorept \ignoreit ; \_endcode % ------------------------------------- diff --git a/macros/luatex/optex/multicolumns.opm b/macros/luatex/optex/multicolumns.opm index cc5a0fad09..291eb1cfd0 100644 --- a/macros/luatex/optex/multicolumns.opm +++ b/macros/luatex/optex/multicolumns.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \begmulti {Balanced columns <2020-03-08>} +\_codedecl \begmulti {Balanced columns <2020-03-08>} % preloaded in format \_doc ----------------------------- This code is documented in detail in the \"\TeX/book naruby", pages 244--246, diff --git a/macros/luatex/optex/op-demo.tex b/macros/luatex/optex/op-demo.tex index 96c32f9056..ea1dd5b65d 100644 --- a/macros/luatex/optex/op-demo.tex +++ b/macros/luatex/optex/op-demo.tex @@ -1,5 +1,7 @@ -\fontfam[LMfonts] - +%% This is part of OpTeX project, see http://petr.olsak.net/optex + +\fontfam[LMfonts] % Default font family: Latin Modern + \margins/1 a5 (1,1,1,1.4)cm % A5 paper + 1cm margins \typosize[9/10.5] % 9pt font / 10.5pt baselineskip \parindent=10pt % typesetting parameters @@ -95,7 +97,7 @@ This is verbatim. \endtt or it can be included by `\verbinput` from external file. -\verbinput (96-98) op-demo.tex +\verbinput (98-100) op-demo.tex \sec Math diff --git a/macros/luatex/optex/op-letter.tex b/macros/luatex/optex/op-letter.tex new file mode 100644 index 0000000000..3c86405e9a --- /dev/null +++ b/macros/luatex/optex/op-letter.tex @@ -0,0 +1,41 @@ +%% This is part of OpTeX project, see http://petr.olsak.net/optex + +\letter % \letter OpTeX style activated +\fontfam[bonum] +\cslang + +\address + Vážený pan + Mgr. Bořek Byrokrat + ředitel Ústavu pro další možnosti + Úřední 789 + 123 45 Praha 1 + +\hfill V Praze dne \today + +\subject Žádost o možnost další možnosti + +Vážený pane řediteli + +na základě Vašeho dopisu č.j.~123456/78-dat a elektronické výzvy si dovoluji +Vás požádat o prozkoumání mé možnosti další možnosti. +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do +eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim +veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea +commodo consequat. + +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do +eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim +veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea +commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit +esse cillum dolore eu fugiat nulla pariatur. + +S úctou + +\hfill \address + {\it Petr Olšák} + specialista na \TeX/ + Ulice 12345 + Praha 13 + +\bye diff --git a/macros/luatex/optex/op-ring.png b/macros/luatex/optex/op-ring.png Binary files differindex 8c8cb5976a..de7811df83 100644 --- a/macros/luatex/optex/op-ring.png +++ b/macros/luatex/optex/op-ring.png diff --git a/macros/luatex/optex/op-slides.tex b/macros/luatex/optex/op-slides.tex new file mode 100644 index 0000000000..fb691fcd9d --- /dev/null +++ b/macros/luatex/optex/op-slides.tex @@ -0,0 +1,288 @@ +%% This is part of OpTeX project, see http://petr.olsak.net/optex + +\slides % OpTeX slides style activated + +\catcode`<=13 % special printing of <text> +\def<#1>{\hbox{$\langle$\it#1\/$\rangle$}} +\everyintt={\catcode`\<=13} + +\hyperlinks\Blue\Blue % hyperlinks are used in the title page +\backgroundpic{slides-bg.png} % background picture + +\activettchar` % inline verbatim +\enquotes % English quotes \"..." + +\slideshow %------------------------------------------------------------ + + +\tit \OpTeX/ slides + +\subtit Petr Olšák\nl petr@olsak.net + +\subtit\rm \url{http://petr.olsak.net/optex} + +\pg; %------------------------------------------------------------------ + +\sec Basics + +* The the simple document looks like: + +\begtt +\slides % style initialized +%\wideformat % 16:9 +\slideshow % partially uncovering ideas + +\sec First slide +text +\pg; + +\sec Second slide +text +\pg. +\endtt + +* If `\slideshow` is missing or commented out then + \"partially uncovering ideas" (see later) are deactivated. It is useful + for printing. +* The `\slideshow` must be the last command in the declaration part of the + document. +* By default, the slides have A5 landscape format. + You can declare `\wideformat`. Then the height is the same + but width is 263\,mm, i.\,e.~the ratio width:height is 16:9. + +\pg; %------------------------------------------------------------------ + +\sec Title slide + +* Title of the document (used at the first slide) is created + by `\tit Title` (terminated by end of line). +* The `\subtit Author name etc.`\ (terminated by end of line) + can be used after `\tit` at the first slide. +* You can use `\nl` for new line in paragraphs or titles. + +\sec Default design + +* The paragraph texts are ragged right. +* Titles, subtitles and section titles are centered. +* The `\sec` and `\secc` are printed without numbers. +* Paragraph indentation is zero. There is a little vertical space between + paragraphs. +* The Heros font family (aka Helvetica) is initialized as default.\nl + Sans-serif FiraMath font for math typesetting is used. +* The items in lists are started by blue square (`\type X` and `\type x` ). + +\pg; %------------------------------------------------------------------ + +\sec One slide (one page) + +* Top level item list is activated by default. The asterisk `*` opens + new item at the top level list. +* Nested items lists (second and more level) should be created in + the `\begitems`\dots`\enditems` environments. +* Each slide (page) must be terminated by `\pg;` command. +* Lats slide must be terminated by `\pg.` command or by `\bye`. + +\begtt +\sec My ideas + +* First idea +* Second idea + \begitems + * First sub-idea + * Second sub-idea + \enditems +* Final idea +\endtt + +* Note: each page is processed in a group, so: put your own definitions + (if~exist) before `\slideshow` or use `\global` assignment. + +\pg; %------------------------------------------------------------------ + +\sec Partially uncovering ideas + +* The control sequence `\pg` must be followed by:\pg+ +\begitems +* the character `;` -- normal next page,\pg+ +* the character `.` -- the end of the document,\pg+ +* the character `+` -- next page keeps the same text + and a next text is added (usable for partially uncovering of ideas).\pg+ +\enditems + +* Summary: +\begtt +\pg; ... next page +\pg. ... the end of the document +\pg+ ... uncover next text at the same page +\endtt +\pg+ + +* When `\slideshow` is not declared then `\pg+` is deactivated.\pg+ +* The `\pg+` creates a new \"virtual page", so the current paragraph is + terminated. + +\pg; %------------------------------------------------------------------ + +\sec Example with partially uncovering ideas + +The previous page was created by: + +\begtt +\sec Partially uncovering ideas + +* The control sequence `\pg` must be followed by:\pg+ + +\begitems +* the character `.` -- normal next page,\pg+ +* the character `;` -- the end of the document,\pg+ +* the character `+` -- next ... \pg+ +\enditems + +* Summary +... +* When `\slideshow` is not declared + then `\pg+` is deactivated.\pg+ +* The `\pg+` creates a new \"virtual page", + so the current paragraph is terminated. +\pg; +\endtt + +\pg; %------------------------------------------------------------------ + +\sec Notes + +* When `\slideshow` is active then you cannot reference sections by + hyperlinked `\ref`. Only `\pgref` works (and goes to the last layer + of the referenced page). +* If the text overfull the page (slide) then it follows to the next page without + saying explicitly `\pg;`. But `\slideshow` cannot work in such case.\pg+ + +\sec More about design + +* You can use `\backgroundpic{<image-file>}` for putting an image to the backgroud. +* You can re-declare `\footline` or re-define internal macros for design as + you wish. +* You can put the images or text wherever using `\putimege` or `\puttext` + macros... + +\pg; %------------------------------------------------------------------ + +\sec Putting images and text wherever + +* `\puttext <down> <right> {<text>}` puts a <text> to the desired place: + It moves the current point <down> and <right>, puts the <text> and returns + back, so the typesetting continues from previous position. The parameters + <down> and <right> are dimensions. For example + +\begtt +\puttext -50mm 0mm {\Red HELLO} +\endtt + + \puttext -50mm 0mm {\Red HELLO} + prints red HELLO, as shown here.\pg+ + +* `\putpic <down> <right> <width> <height> {<image-file>}` + puts the image with desired <width> and <height> at the position like + `\puttext` puts the text. + + \putpic -20mm .8\hsize 30mm \nospec {op-ring.png} +* The ring above is the result of + +\begtt +\putpic -20mm .8\hsize 30mm \nospec {op-ring.png} +\endtt + % + used ad beginning of this paragraph.\pg+ +* Use `\nospec` for <width> or <height> of the image if you don't want to specify both + dimensions (because you don't want to change the image aspect ratio). + +\pg; %------------------------------------------------------------------ + +\sec Limits of the \code{\\pg+} sequence + +* The \code{\\pg+} sequence (partially uncovering ideas) cannot be used inside + a~group. +* The exception is the nested environment `\begitems...\enditems`. +* The `\pg+` always finalizes the current paragraph. + It is impossible to hide only a part of horizontal mode.\pg+ + +\sec The \code{\\layers}\,...\code{\\endlayers} environment + +If you really need something unsupported by `\pg+` then you can use + +\begtt \catcode`\<=13 +\layers <number> +<layered text> +\endlayers +\endtt + +* The <layered text> should include conditions like + `\ifnum\layernum...` or `\ifcase\layernum`. + It is printed <number> times to more slide pages (layers) with the same + surrounding text. See next page... + +\pg; %------------------------------------------------------------------ + +\sec Example of \code{\\layers} environment + +The `\slides` style provides a shortcut `\use` and a macro `\pshow` (means +partially show): + +\begtt +\def\use#1#2{\ifnum\layernum#1\relax#2\fi} +\def\pshow#1{\use{=#1}\Red \use{<#1}\Transparent \ignorespaces} +\endtt + +The `{\pshow<num> <text>}` prints <text> in Red when current layer is equal +to <num> or it prints <text> normally when current layers is greater than <num>. +The transparent (invisible) font is used in other cases. + +The following dance: +\layers 3 +{\pshow2 Second text.} {\pshow3 Third text.} {\pshow1 First text.} +\endlayers +\pg+ + +was generated by + +\begtt +\layers 3 +{\pshow2 Second text.} {\pshow3 Third text.} {\pshow1 First text.} +\endlayers +\endtt + +\pg+ +* The <layered text> is treated as macro parameter. So, you cannot use verbatim + nor `\sec` titles here. Maximal one `\layers` environment can be per one + page (terminated by `\pg+` or `\pg;` or `\pg.` + +\pg; %------------------------------------------------------------------ + +\sec Comparison \OpTeX/ slides with Beamer\fnote{\url{http://www.ctan.org/pkg/beamer}} + +The \LaTeX{} package {\bf\Blue Beamer} gives much more features and many themes +are prepared for Beamer, {\bf\Red but} +\pg+ +* the user of Beamer is forced to {\em program} his/her document using + dozens of \code{\\begin{foo}} and \code{\\end{foo}} and many another + programming constructions,\pg+ +* plain \TeX{} gives you a possibility to simply + {\em write} your document with minimal markup. The result is more compact. + You can concentrate to the contents of your document, not to the + programming syntax.\pg+ +* User needs to read 250 pages of doc for understanding Beamer,\pg+ +* on the other hand, you need to read only ten + slides\fnote{this eleventh slide isn't counted} + and you are ready to use {\bf\Blue\OpTeX/ slides}. + +\pg; %------------------------------------------------------------------ + +\null +\vskip2cm +\centerline{\typosize[35/40]\bf Thanks for your attention}\pg+ + +\vskip2cm +\centerline{\Blue\typosize[60/70]\bf Questions?} + +\pg. %----------------------------- THE END ---------------------------- + diff --git a/macros/luatex/optex/opmac-rest.opm b/macros/luatex/optex/opmac-rest.opm deleted file mode 100644 index f8731fefda..0000000000 --- a/macros/luatex/optex/opmac-rest.opm +++ /dev/null @@ -1,65 +0,0 @@ -% I plan to re-implement all macros from this file. Something is done already. - -% OPmac -%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Petr Olsak, 2012 -- 2019 - -%% The history of versions is at the end of this file, after \endpinput - -\ifx\OPmacversion\undefined \else \endinput \fi -\def\OPmacversion{Jul. 2019} -\immediate\write16{This is OPmac-rest, version <\OPmacversion>} - -%%%%%%%%%%%%%% Basic macros, sec. 3.1 in opmac-d.pdf - -%\newif\ifpdftex \pdftextrue - -%%%%%%%%%%%%%% Global parameters, sec. 3.2 in opmac-d.pdf - -%%%%%%%%%%%%%% OPmac, CSplain and LaTeX logos, sec. 3.3 in opmac-d.pdf - -%%%%%%%%%%%%%% Sizes of fonts and \baselineskip, sec. 3.4 in opmac-d.pdf - -%%%%%%%%%%%%%% Multilingual support, sec. 3.5 in opmac-d.pdf - -%%%%%%%%%%%%%% REF file, sec 3.6 in opmac-d.pdf - -%%%%%%%%%%%%%% \label, \ref, \pgref, sec. 3.7 in opmac-d.pdf - -%%%%%%%%%%%%%% Chapters, sections, subsections -- sec. 3.8 in opmac-d.pdf - -%%%%%%%%%%%%%% Captions, equations -- sec. 3.9 in opmac-d.pdf - -%%%%%%%%%%%%%% Items -- sec. 3.10 in opmac-d.pdf - -%%%%%%%%%%%%%% TOC -- sec. 3.11 in opmac-d.pdf - -%%%%%%%%%%%%%% Index -- sec. 3.12 on opmac-d.pdf - -%%%%%%%%%%%%%% \begmulti ... \endmulti TBN p. 244, 245 -- sec. 3.14 in opmac-d.pdf - -%%%%%%%%%%%%%% Colors -- sec. 3.15 in opmac-d.pdf - -%%%%%%%%%%%%%% Hyperrefs -- sec. 3.16 in opmac-d.pdf - -%%%%%%%%%%%%%% Outlines -- sec. 3.17 in opmac-d.pdf - -%%%%%%%%%%%%%% Verbatim, \begtt, \endtt -- sec. 3.18 in opmac-d.pdf - -%%%%%%%%%%%%%% \table -- sec. 3.19 in opmac-d.pdf - -%%%%%%%%%%%%%% \inspic -- sec. 3.20 in opmac-d.pdf - -%%%%%%%%%%%%%%% transformation matrix -- sec. 3.21 in opmac-d.pdf - -%%%%%%%%%%%%%% \fnote, \mnote -- sec 3.22 in opmac-d.pdf - -%%%%%%%%%%%%%% \cite, \bib, \usebibtex, \usebbl -- sec. 3.23 in opmac-d.pdf - -%%%%%%%%%%%%%% output -- sec. 3.24 in opmac-d.pdf - -%%%%%%%%%%%%%% margins -- sec. 3.25 in opmac-d.pdf - -%%%%%%%%%%%%%% Pre-defined document styles - -\endinput diff --git a/macros/luatex/optex/optex.ini b/macros/luatex/optex/optex.ini index 370f60f099..e4a09eec0a 100644 --- a/macros/luatex/optex/optex.ini +++ b/macros/luatex/optex/optex.ini @@ -20,7 +20,7 @@ % OpTeX version -\def\optexversion{Alpha 0.06 Mar 2020} +\def\optexversion{Alpha 0.07 Mar 2020} % Engine testing: @@ -50,7 +50,7 @@ \input alloc.opm % allocators for registers \input if-macros.opm % special \if-macros, \is-macros and loops \input parameters.opm % parameters setting -\input op-macros.opm % OpTeX useful macros (todo: doc) +\input more-macros.opm % OpTeX useful macros (todo: doc) \input plain-macros.opm % plainTeX macros (todo:doc) \input fonts-preload.opm % preloaded Latin Modern fonts \input fonts-resize.opm % font resizing (low-level macros) (todo: texdoc) diff --git a/macros/luatex/optex/others.opm b/macros/luatex/optex/others.opm index 7043a7589c..4c6b49dd2d 100644 --- a/macros/luatex/optex/others.opm +++ b/macros/luatex/optex/others.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \uv {Miscenaleous <2020-01-23>} +\_codedecl \uv {Miscenaleous <2020-03-14>} % preloaded in format % You can write \useOpTeX at begining of your document diff --git a/macros/luatex/optex/outlines.opm b/macros/luatex/optex/outlines.opm index fbad18cb20..90e9a4a0aa 100644 --- a/macros/luatex/optex/outlines.opm +++ b/macros/luatex/optex/outlines.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \pdfunidef {PDF outlines <2019-05-21>} +\_codedecl \pdfunidef {PDF outlines <2020-03-12>} % preloaded in format \_def\_outlines#1{\_pdfcatalog{/PageMode/UseOutlines}\_openref \_ifx\_toclist\_empty diff --git a/macros/luatex/optex/output.opm b/macros/luatex/optex/output.opm index 0bdefdb1ec..a81e5e8c0a 100644 --- a/macros/luatex/optex/output.opm +++ b/macros/luatex/optex/output.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \nopagenumbers {Output routine <2019-05-21>} +\_codedecl \nopagenumbers {Output routine <2020-03-15>} % preloaded in format \_doc ----------------------------- `\_optexouput` is default output routine. You can create another... @@ -180,20 +180,17 @@ water color marks. \_cod ----------------------------- -\_def\_draft{\_pgbackground={\_setdraftfont \_draftbox{\_draftfont DRAFT}}} - -\_def\_draftbox#1{\_setbox0=\_hbox{#1}% +\_def \_draft {\_pgbackground={\_draftbox{\_draftfont DRAFT}}% + \_fontdef\_draftfont{\_setfontsize{at10pt}\_bf}% + \_global\_let\_draftfont=\_draftfont +} +\_def \_draftbox #1{\_setbox0=\_hbox{#1}% \_kern.5\_vsize \_kern4.5\_wd0 \_hbox to0pt{\_kern.5\_hsize \_kern-1\_wd0 \_pdfsave \_pdfrotate{55}\_pdfscale{10}{10}% \_hbox to0pt{\_localcolor\LightGrey \_box0\_hss}% \_pdfrestore - \_hss}} -\_def\_setdraftfont {% - \_ifx \_draftfont\_undefined - \_fontdef\_draftfont{\_setfontsize{at10pt}\_bf}% - \_global\_let\_draftfont=\_draftfont - \_fi + \_hss}% } \_public \draft ; diff --git a/macros/luatex/optex/parameters.opm b/macros/luatex/optex/parameters.opm index 23702de37a..4ae0aa4d98 100644 --- a/macros/luatex/optex/parameters.opm +++ b/macros/luatex/optex/parameters.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \normalbaselineskip {Parameter settings <2020-01-23>} +\_codedecl \normalbaselineskip {Parameter settings <2020-03-17>} % preloaded in format \_doc ----------------------------- The primitive registers with the same default value as in plain \TeX/ follow: @@ -241,12 +241,15 @@ \_doc ----------------------------- The default item mark used between `\bgitems` and `\enditems` is bullet. The `\everyitem` token list is applied in vertical mode - at the start of each item. + at the start of each item. + The `\everybegitems` token list is applied after group is openem by + `\begitems`. \_cod ----------------------------- \_newtoks\_defaultitem \_defaultitem={$\_bullet$\_enspace} \_newtoks\_everyitem -\_public \defaultitem \everyitem ; +\_newtoks\_everybegitems +\_public \defaultitem \everyitem \everybegitems ; \_doc ----------------------------- The `\tit` macro includes `\vglue\titskip` above the title of the document. diff --git a/macros/luatex/optex/pdfuni-string.opm b/macros/luatex/optex/pdfuni-string.opm index 0aafcce27a..e993e61a75 100644 --- a/macros/luatex/optex/pdfuni-string.opm +++ b/macros/luatex/optex/pdfuni-string.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \pdfunidef {PDFunicode strings for outlines <2020-02-14>} +\_codedecl \pdfunidef {PDFunicode strings for outlines <2020-03-12>} % preloaded in format \_edef\_octalprint#1#2{\_noexpand\_directlua{% #1=character-code #2=character if ('#2'>='A' and '#2'<='Z') or ('#2'>='a' and '#2'<='z') then diff --git a/macros/luatex/optex/plain-macros.opm b/macros/luatex/optex/plain-macros.opm index a9e4f2de1b..18576c1ad7 100644 --- a/macros/luatex/optex/plain-macros.opm +++ b/macros/luatex/optex/plain-macros.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \magstep {Macros from plain TeX <2019-02-14>} +\_codedecl \magstep {Macros from plain TeX <2020-02-14>} % preloaded in format \_chardef\_active = 13 diff --git a/macros/luatex/optex/prefixed.opm b/macros/luatex/optex/prefixed.opm index 06c46ee65d..e6015bc7cb 100644 --- a/macros/luatex/optex/prefixed.opm +++ b/macros/luatex/optex/prefixed.opm @@ -1,7 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \public {Prefixing and code syntax <2020-02-14>} - +\_codedecl \public {Prefixing and code syntax <2020-02-14>} % preloaded in format \_doc --------- All TeX82 primitives have alternative control sequence \_hbox \_string, ... diff --git a/macros/luatex/optex/ref-file.opm b/macros/luatex/optex/ref-file.opm index ba76563ca0..5f2b50f06d 100644 --- a/macros/luatex/optex/ref-file.opm +++ b/macros/luatex/optex/ref-file.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \_openref {File for references <2020-02-14>} +\_codedecl \openref {File for references <2020-02-14>} % preloaded in format \_doc -------------------------- The `\_inputref` macro is used in `\everyjob`. It reads `\jobname.ref` file @@ -44,6 +44,7 @@ \_immediate\_write\_reffile {\_pcent\_pcent\_space OPTeX <\_optexversion> - REF file (#1)}% \_immediate\_wref \Xrefversion{{\_REFversion}}% } +\def\openref{\_openref} \_doc ---------------------- We are using a convention that the macros used in `.ref` file are named diff --git a/macros/luatex/optex/references.opm b/macros/luatex/optex/references.opm index 37d0698214..3cd27c043e 100644 --- a/macros/luatex/optex/references.opm +++ b/macros/luatex/optex/references.opm @@ -1,11 +1,10 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \ref {References <2020-02-22>} +\_codedecl \ref {References <2020-03-03>} % preloaded in format \_doc ---------------------------- - `\_Xpage {<gpageno>}{<pageno>}` saves the patameter pair into `\_currpage` - and actualizes `\lastpage`. Resets `\_lfnotenum` used if footnotes are - numbered from one at each page. + `\_Xpage {<gpageno>}{<pageno>}` saves the patameter pair into `\_currpage`. + Resets `\_lfnotenum`, it is used if footnotes are numbered from one at each page. \_cod ---------------------------- \_def\_Xpage#1#2{\_def\_currpage{{#1}{#2}}\_lfnotenum=0 } @@ -31,6 +30,7 @@ \_def\_wlabel#1{% \_ifx\_lastlabel\_undefined \_else \_dest[ref:\_lastlabel]% + \_printlabel\_lastlabel \_edef\_tmp{{\_lastlabel}{#1}}% \_ea\_wref \_ea\_Xlabel \_ea{\_tmp}% \_sxdef{_lab:\_lastlabel}{#1}\_sxdef{l0:\_lastlabel}{}% @@ -62,6 +62,19 @@ \_public \label \wlabel \ref \pgref ; + \_doc ----------------------------- + Default `\_printlabel` is empty (labes are not printed). + The `\showlabels` redefines it as box with zero dimensions and + with left lapped `[<label>]` in blue 10pt `\tt` font shifted up by 1.7ex. + \_cod ----------------------------- + +\_def\_printlabel#1{} +\_def\_showlabels {% + \_def\_printlabel##1{\_vbox to0pt{\_vss\_llap{\_labelfont[##1]}\_kern1.7ex}}% + \_fontdef\_labelfont{\_setfontsize{at10pt}\setfontcolor{blue}\_tt} +} +\_public \showlabels ; + \_endcode %------------------------------------------ diff --git a/macros/luatex/optex/sections.opm b/macros/luatex/optex/sections.opm index e528680d42..dae71df77a 100644 --- a/macros/luatex/optex/sections.opm +++ b/macros/luatex/optex/sections.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \chap {Titles, chapters, sections, subsections <2020-03-02>} +\_codedecl \chap {Titles, chapters, sections, subsections <2020-03-14>} % preloaded in format \_doc --------------------------- We are using scaled fonts for titles. They are scaled from main fonts size diff --git a/macros/luatex/optex/slides-bg.png b/macros/luatex/optex/slides-bg.png Binary files differnew file mode 100644 index 0000000000..4ac1ad8c38 --- /dev/null +++ b/macros/luatex/optex/slides-bg.png diff --git a/macros/luatex/optex/slides.opm b/macros/luatex/optex/slides.opm new file mode 100644 index 0000000000..faff579798 --- /dev/null +++ b/macros/luatex/optex/slides.opm @@ -0,0 +1,211 @@ +% This is part of OpTeX project, see http://petr.olsak.net/optex + +\_codedecl \slideshow {Slides style for OpTeX <2020-03-19>} % loaded on demand by \slides + + \_doc ----------------------------- + Default margins and design is declared here. + Note that `\_ttfont` is scaled by `mag1.15` in order to balance the + ex height of Helvetica (Heros) and LM fonts Typewriter. + The `\begtt`...`\endtt` verbatim is printed by smaller text. + \_cod ----------------------------- + +\_margins/1 a5l (14,14,10,3)mm % landscape A5 format +\_def\_wideformat{\_margins/1 (263,148) (16,16,10,3)mm } % 16:9 format + +\_fontfam[Heros] +\_typosize[16/19] +\_famvardef\_ttfont{\_setfontsize{mag1.15}\_tt} +\_def\_urlfont{} +\_everytt={\_typosize[13/16] \advance\hsize by10mm} +\_fontdef\_fixbf{\_bf} + +\_nopagenumbers +\_parindent=0pt +\_ttindent=5mm +\_parskip=5pt plus 4pt minus2pt +\_rightskip=0pt plus 1fil +\_ttindent=10pt +\_def\_ttskip{\_smallskip} + +\_onlyrgb % RGB color space is better for presentations + + \_doc ----------------------------- + The bottom margin is set to 3\,mm. If we use 1\,mm, then baseline of + `\footline` is 2\,mm from the bottom page. This is depth of the `\Grey` + rectange used for page numbers. It is rlapped to `\hoffset` because left + margin = `\hoffset` = right margin. It is 14\,mm for narrow pages or + 16\,mm for wide pages. + \_cod ----------------------------- + +\_footlinedist=1mm +\_footline={\_hss \_rlap{% + \_rlap{\Grey\_kern.2\_hoffset\_vrule height6mm depth2mm width.8\_hoffset}% + \_hbox to\_hoffset{\White\_hss\_folio\_kern3mm}}} + + \_doc ----------------------------- + The `\subtit` is defined analogicaly like `\tit`. + \_cod ----------------------------- + +\_eoldef\_subtit#1{\_vskip20pt {\_leftskip=0pt plus1fill \_rightskip=\_leftskip + \_subtitfont #1\_nbpar}} + + \_doc ----------------------------- + The `\pshow<num>` is implemented by printing the text in invisible + (transparent) font when `\layernum<<num>`. + The color font feature is used for this transparency. + \_cod ----------------------------- + +\_famvardef\Transparent{\_setfontcolor{FF000000}\_currvar} +\_def\_use#1#2{\_ifnum\_layernum#1\_relax#2\_fi} +\_def\_pshow#1{\_use{=#1}\Red \_use{<#1}\Transparent \_ignorespaces} + + \_doc ----------------------------- + The main level list is activated here. The `\_item:X` and + `\_item:x` are used and are re-defined here. + If we are in nested level of items and `\pg+` is used then + `\egroups` macro xepands to the right number of `\egroup`s + in order to close page correctly. The level of nested item lists + is saved to the `\_ilevel` register and used when we start again + the next text after `\pg+`. + \_cod ----------------------------- + +\_newcount\_ilevel \_newcount\_gilevel +\_def\*{*} +\_adef*{\_startitem} +\_sdef{_item:X}{\Blue\_raise.2ex\_fullrectangle{.8ex}\_kern.5em} +\_sdef{_item:x}{\Blue\_raise.3ex\_fullrectangle{.6ex}\_kern.4em} +\_style X +\_addto\_begitems{\_style x }\public \begitems ; +\_def\_egroups{\_par\_global\_gilevel=\_ilevel \_egroup} +\_everybegitems={\_advance\_ilevel by1 \_addto\_egroups{\_egroup}} + + \_doc ----------------------------- + The default values of `\pg;`, `\pg+` and `\pg.` are very simple. + They are used when `\showslides` is not specified. + \_cod ----------------------------- + +\_def\_pg#1{\_cs{_spg:#1}} +\_sdef{_spg:;}{\_vfil\_break \_lfnotenumreset} +\_sdef{_spg:.}{\_end} +\_sdef{_spg:+}{\_par} + + \_doc ----------------------------- + We need no numbers and no table of contents when using slides. + The `\_printsec` macro is redefined in order the title is centered + and typeset in `\Blue`. + \_cod ----------------------------- + +\_def\_titfont{\_typosize[42/60]\_bf \Blue} +\_def\_subtitfont{\_typosize[20/30]\_bf} +\_def\_secfont{\_typosize[25/30]\_bf \Blue} + +\_nonum \_notoc \_let\_resetnonumnotoc=\_relax +\_def\_printsec#1{\_par + \_abovetitle{\_penalty-400}\_bigskip + {\_secfont \_noindent \_leftskip=0pt plus1fill \_rightskip=\_leftskip + \_printrefnum[@\_quad]#1\_nbpar}\_insertmark{#1}% + \_nobreak \_belowtitle{\_medskip}% +} + + \_doc ----------------------------- + When `\slideshow` is active then each page is opened (roughly speaking) + by `\setbox\_slidepage=\vbox\bgroup` and closed by `\egroup`. The material is + `\unvbox`ed and saved for the usage in the next usage if `\pg+` is in process. + The `\_slidelayer` is inceremnted instead `\pageno` if `\pg+`. + This counter is equal to `\count1`, so it is printed to the terminal and + log file next to `\pageno`. + + 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 `\_sidepage` box and the material after it is in `\_slidepageB` + box. The pages are completrd in the `\loop` which increments the + `\layernum` register. + \_cod ----------------------------- + +\_newbox\_slidepage \_newbox\_slidepageB +\_countdef\_slidelayer=1 +\_def\_decr#1{\_global\_advance#1 by-1 } + +\_def\_slideshow{\_slidelayer=1 \_slideshowactive \_setbox\_slidepage=\_vbox\_bgroup} + +\_def\_slideshowactive{% + \_sdef{_spg:;}{\_closepage \_global\_slidelayer=1 \_resetpage \_openslide} + \_sdef{_spg:.}{\_closepage \_end} + \_sdef{_spg:+}{\_closepage \_incr\_slidelayer \_decr\_pageno \_openslide} + \_def\bye {\_closepage \_end} + \_let\_layers=\_layersactive + \_def\_destbox[##1:##2]{\_isequal{##1}{ref}\_iffalse \_destboxori[##1:##2]\_fi}% +} +\_def\_openslide{\_setbox\_slidepage=\_vbox\_bgroup \_setilevel + \_ifvoid\_slidepage \_else \_unvbox\_slidepage \_nointerlineskip\_lastbox \_fi} +\_def\_setilevel{\_loop \_decr\_gilevel \_ifnum\_gilevel<0 \_else \_begitems \_repeat} + +\_def\_closepage{\_egroups + \_ifnum \_maxlayers=0 \_unvcopy\_slidepage \_vfil\_break + \_else \_begingroup \_setwarnslides \_layernum=0 + \_loop + \_ifnum\_layernum<\_maxlayers \_advance\_layernum by1 + \_printlayers \_vfil\_break + \_ifnum\_layernum<\_maxlayers \_incr\_slidelayer \_decr\_pageno \_fi + \_repeat + \_global\_maxlayers=0 + \_incr\_layernum \_global\_setbox\_slidepage=\_vbox{\_printlayers}% + \_endgroup + \_fi} +\_def\_resetpage{% + \_global\_setbox\_slidepage=\_box\_voidbox \_global\_setbox\_slidepageB=\_box\_voidbox + \_lfnotenumreset +} +\_def\_setwarnslides{% + \_def\pg##1{\_opwarning{\_string\pg##1 \_layersenv}\_def\pg####1{}}% + \_def\layers##1 {\_opwarning{\_string\layers\_space \_layersenv}\_def\layers####1{}}% +} +\_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 + \_vskip\_parskip + \_unvcopy\_slidepageB +} +\_let\_destboxori=\_destbox + +\_newcount\_layernum \_newcount\_maxlayers +\_maxlayers=0 + +\_long\_def\_layersactive #1 #2\endlayers{% + \_par\_egroup + \_gdef\_layertext{#2}% + \_global\_maxlayers=#1 + \_setbox\_slidepageB=\_vbox\_bgroup +} + + \_doc ----------------------------- + Default `\layers <num>` macro (when `\slideshow` is not activated) is simple. + It prints the <layered-text> with `\layernum=<num>+1` because we need the + result after last layer is processed. + \_cod ----------------------------- + +\_def\_layers #1 {\_par\_layernum=\_numexpr#1+1\_relax} +\_let\endlayers=\_relax + +\_def\layers{\_layers} +\_public \subtit \slideshow \pg \wideformat \use \pshow ; + + \_doc ----------------------------- + We must to redefine `\fnotenumpages` because the data from `.ref` file + are less usable for implementing such feature: the + footnote should be in more layers repeatedly. But we can suppose that + each page starts by `\pg;` macro, so we can reset the footnote counter by + this macro. + \_cod ----------------------------- + +\_def \_fnotenumpages {\def\_fnotenum{\_the\_lfnotenum}\_pgfnotefalse + \_def\_lfnotenumreset{\_global\_lfnotenum=0 }} +\_let \_lfnotenumreset=\_relax +\_public \fnotenumpages ; + +\_endcode % ---------------------------------------------- + +The user manual of \OpTeX/ slides are in `op-slides.tex` file. + diff --git a/macros/luatex/optex/styles.opm b/macros/luatex/optex/styles.opm index 66414f85ff..13aaec91b2 100644 --- a/macros/luatex/optex/styles.opm +++ b/macros/luatex/optex/styles.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \report {Basic styles of OpTeX <2020-03-12>} +\_codedecl \report {Basic styles of OpTeX <2020-03-18>} % preloaded in format \_doc ----------------------------- The `{\boxlines <line-1><eol><line-2><eol>...<line-n><eol>}` @@ -46,7 +46,12 @@ \_parskip=\_medskipamount \_nopagenumbers } -\_public \boxlines \letter \report ; + +\_def\_slides{\_par + \_input slides.opm +} + +\_public \boxlines \letter \report \slides ; \_endcode % ------------------------------------- diff --git a/macros/luatex/optex/table.opm b/macros/luatex/optex/table.opm index 3596275e48..c210c75b34 100644 --- a/macros/luatex/optex/table.opm +++ b/macros/luatex/optex/table.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \table {Basic macros for OpTeX <2020-03-12>} +\_codedecl \table {Basic macros for OpTeX <2020-03-13>} % preloaded in format \_doc ----------------------------- The result of `\table` is inserted into `\_tablebox`. You can change diff --git a/macros/luatex/optex/uni-lcuc.opm b/macros/luatex/optex/uni-lcuc.opm index 3e753370d9..92ed39d24c 100644 --- a/macros/luatex/optex/uni-lcuc.opm +++ b/macros/luatex/optex/uni-lcuc.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -% A copy o uni-lcuc.tex fom csplain is here +% Preloaded in format. A copy o uni-lcuc.tex fom csplain is here: % uni-lcuc.tex -- sets \lccodes and \uccodes for Unicode chars, nothing more %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/macros/luatex/optex/unimath-codes.opm b/macros/luatex/optex/unimath-codes.opm index 3e5b95669d..83d59835b5 100644 --- a/macros/luatex/optex/unimath-codes.opm +++ b/macros/luatex/optex/unimath-codes.opm @@ -1,8 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -% This file is read when \loadmath is used. - -\_ifx \_ncharrmA\_undefined \_else \_endinput \_fi +\_codedecl \_ncharrmA {Uni math codes <2020-03-14>} % preloaded on demand by \loadmath \_umathnumB="0391 \_greekdef \Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta \Iota \Kappa diff --git a/macros/luatex/optex/usebib.opm b/macros/luatex/optex/usebib.opm index ebaf912b53..de6a0bf40d 100644 --- a/macros/luatex/optex/usebib.opm +++ b/macros/luatex/optex/usebib.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_ifx\MakeReference\_udefined \_else \_endinput \_fi +\_codedecl \MakeReference {Reading bib databases <2020-03-13>} % loaded on demand by \usebib % we needn't \errmessage when bad TeX engnine is detected during \input librarian: @@ -113,7 +113,8 @@ \_bibmark=\_ea{\_tmpb}% \_else \_bibmark={}\_fi \_edef\_tmpb{\EntryKey}% - \_noindent \_dest[cite:\_the\_bibnum]\_printbib + \_noindent \_dest[cite:\_the\_bibnum]\_printlabel\EntryKey + \_printbib {% \_RetrieveFieldIn{entrytype}\_entrytype \_csname _print:BEGIN\_endcsname diff --git a/macros/luatex/optex/verbatim.opm b/macros/luatex/optex/verbatim.opm index e0f86c810e..c7593a7d7a 100644 --- a/macros/luatex/optex/verbatim.opm +++ b/macros/luatex/optex/verbatim.opm @@ -1,6 +1,6 @@ %% This is part of OpTeX project, see http://petr.olsak.net/optex -\_codedecl \begtt {Verbatim <2020-02-14>} +\_codedecl \begtt {Verbatim <2020-03-18>} % preloaded in format \_doc ---------------------------- The internal parameters for verbatim macros are set. @@ -10,6 +10,7 @@ \_mathchardef\_ttpenalty=100 % penalty between lines in \begtt, \verbinput \_newcount\_viline % last line number in \verbinput \_newread\_vifile % file fgiven by \verinput +\_def\_ttfont{\_tt} % default tt font \_doc ---------------------------- `\code{<text>}` expands to `\detokenize{<text>}` when `\escapechar=-1`. In @@ -31,7 +32,7 @@ \_cod ---------------------------- \_def\_code#1{\_unexpanded\_ea{\_csname _code \_endcsname{#1}}} -\_protected\_sdef{_code }#1{{\_escapechar=-1 \_tt \_the\_everyintt \_relax +\_protected\_sdef{_code }#1{{\_escapechar=-1 \_ttfont \_the\_everyintt \_relax \_ea\_printinverbatim\_ea{\_detokenize{#1}}}} \_def\_printinverbatim#1{\_leavevmode\_hbox{#1}} @@ -77,7 +78,7 @@ \_ifx\_savedttchar\_undefined\_else \_catcode\_savedttchar=\_savedttcharc \_fi \_chardef\_savedttchar=`#1 \_chardef\_savedttcharc=\_catcode`#1 - \_adef{#1}{\_begingroup \_setverb \_adef{ }{\ }\_tt \_the\_everyintt\_relax \_readverb}% + \_adef{#1}{\_begingroup \_setverb \_adef{ }{\ }\_ttfont \_the\_everyintt\_relax \_readverb}% \_def\_readverb ##1#1{\_printinverbatim{##1}\_endgroup}% } \_public \activettchar ; @@ -126,7 +127,7 @@ \_setverb \_ifnum\_ttline<0 \_let\_printverblinenum=\_relax \_else \_initverblinenum \_fi \_adef{ }{\ }\_parindent=\_ttindent \_parskip=0pt - \_the\_everytt \_relax #1\_relax \_tt + \_the\_everytt \_relax #1\_relax \_ttfont \_endlinechar=`^^J \_startverb } @@ -135,7 +136,7 @@ \_ea\_printverb \_tmpb\_end \_par\_ttskip \_endgroup - \_noindent \_setbox0=\_lastbox + \_isnextchar\_par{}{\_noindent}% } \_def\_printverb #1^^J#2{\_ifx\_end#2 \_bgroup \_adef{ }{}\_if\_relax#1\_relax\_egroup \_else\_egroup \_printverbline{#1}\_fi @@ -213,7 +214,7 @@ \_begingroup \_ifnum\_ttline<-1 \_let\_printverblinenum=\_relax \_else \_initverblinenum \_fi \_setverb \_adef{ }{\ }\_parindent=\_ttindent \_parskip=0pt - \_the\_everytt\_relax \_tt + \_the\_everytt\_relax \_ttfont \_endlinechar=`^^J \_tmpnum=0 \_loop \_ifeof\_vifile \_tmpnum=\_vinolines\_space \_fi \_ifnum\_tmpnum<\_vinolines\_space |