diff options
Diffstat (limited to 'macros/luatex/optex/base/others.opm')
-rw-r--r-- | macros/luatex/optex/base/others.opm | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/macros/luatex/optex/base/others.opm b/macros/luatex/optex/base/others.opm index 225e54c37a..d96edc4dba 100644 --- a/macros/luatex/optex/base/others.opm +++ b/macros/luatex/optex/base/others.opm @@ -1,4 +1,4 @@ -%% This is part of OpTeX project, see http://petr.olsak.net/optex +%% This is part of the OpTeX project, see http://petr.olsak.net/optex \_codedecl \uv {Miscenaleous <2020-05-22>} % preloaded in format @@ -10,20 +10,18 @@ \_doc ---------------------------- The \`\lastpage` and \`\totalpages` get the information from the - \^`\_currpage`. The \^`\_Xpage` from `.ref` file sets the \^`\_currpage`. + \^`\_currpage`. The \^`\_Xpage` from `.ref` file sets the \^`\_currpage`. \_cod ---------------------------- -\_def\_totalpages {\_openref\_ea\_lastpageA\_currpage} -\_def\_lastpage {\_openref\_ea\_lastpageB\_currpage} -\_def\_lastpageA #1#2{#1} -\_def\_lastpageB #1#2{#2} +\_def\_totalpages {\_openref\_ea\_ignoresecond\_currpage} +\_def\_lastpage {\_openref\_ea\_usesecond\_currpage} \_def\_currpage {{0}{?}} \_public \lastpage \totalpages ; \_doc ---------------------------- We need \`\uv`, \`\clqq`, \`\crqq`, \`\flqq`, \`\frqq`, \`\uslang`, \`\ehyph` - \`\chyph`, \`\shyph`, for backward compatibility with \csplain. - Codes are set according to Unicode, because we are using Czech only in Unicode + \`\chyph`, \`\shyph`, for backward compatibility with \csplain. + Codes are set according to Unicode because we are using Czech only in Unicode when \LuaTeX/ is used. \_cod ---------------------------- @@ -36,18 +34,18 @@ \_def\uv#1{\clqq#1\crqq} -\_let\uslang=\enlang \_let\ehyph=\enlang +\_let\uslang=\enlang \_let\ehyph=\enlang \_let\chyph=\cslang \_let\shyph=\sklang \_let\csUnicode=\csPatt \_let\czUnicode=\csPatt \_let\skUnicode=\skPatt \_doc ---------------------------- - The \`\letfont` was used in \csplain/ instead of `\fontlet`. + The \`\letfont` was used in \csplain/ instead of `\fontlet`. \_cod ---------------------------- \_let \letfont = \_fontlet \_doc ---------------------------- - Non breaking space in Unicode. + Non-breaking space in Unicode. \_cod ---------------------------- \let ^^a0=~ @@ -63,7 +61,7 @@ We don't want to read `opmac.tex` unless `\input opmac` is specified. \_cod ---------------------------- -\_def\OPmacversion{OpTeX} +\_def\OPmacversion{OpTeX} \_doc ---------------------------- We allow empty lines in math formulae. It is more comfortable. @@ -76,29 +74,33 @@ for example `\lipsum[3]` or `\lipsum[112-121]`, max=150. First usage of `\lipsum` reads the \LaTeX/ file `lipsum.ltd.tex` + by \`\_lipsumload` and prints the selected paragraph(s). Next usages of `\lipsum` prints the selected paragraph(s) from memory. This second and more usages of `\lipsum` are fully expandable. If you want to have all printings of `\lipsum` expandable, use dummy `\lipsum[0]` first. + + `\lipsum` adds `\par` after each printed paragraph. If you don't need + such `\par` here, use \`\lipsumtext``[<number>]`. + This macro prints only one selected paragraph <number> and does not add `\par`. \_cod ---------------------------- -\_def \_lipsum {% - {\_long\_def\ProvidesFile##1[##2]##3{\_ifx\_par##3\_relax\_else \_ea##3\_fi}\_tmpnum=0 - \_def\NewLipsumPar{\_advance\_tmpnum by1 - \_afterassignment\_negativermnm \_sxdef{lips:\_the\_tmpnum}}% - \_opinput {lipsum.ltd.tex}% - \_global\_let \_lipsum=\_reallipsum - }\_lipsum -} -\_def\_negativermnm{\_romannumeral-`\.} -\_def\_reallipsum[#1]{\_lipsumA #1\_empty-\_empty\_end} +\_def\_lipsumtext[#1]{\_lipsumload\_cs{_lip:#1}} +\_def\_lipsum[#1]{\_lipsumA #1\_empty-\_empty\_end} \_def\_lipsumA #1-#2\_empty#3\_end{% - \_fornum #1..\_ifx^#2^#1\_else#2\_fi \_do {\_csname lips:##1\_endcsname \par}} - -\def\lipsum {\_lipsum} -\def\lorem {\_lipsum} + \_fornum #1..\_ifx^#2^#1\_else#2\_fi \_do {\_lipsumtext[##1]\par}} +\_def\_lipsumload{{% + \_setbox0=\_vbox{\_tmpnum=0 % vertical mode during \input lipsum.ltd.tex + \_def\ProvidesFile##1[##2]{}% + \_def\NewLipsumPar{\_advance\_tmpnum by1 \_sxdef{_lip:\_the\_tmpnum}}% + \_opinput {lipsum.ltd.tex}% + \_global\_let\_lipsumload=\_empty + }}} +\_public \lipsum \lipsumtext ; +\_let \lorem=\lipsum \_endcode +2021-01-04 \lipsumtext introduced 2020-05-22 \lipsum uses \fornum (expandable after first usage) -2020-04-02 released
\ No newline at end of file +2020-04-02 released |