diff options
Diffstat (limited to 'macros/optex/base/optex-tricks.opm')
-rw-r--r-- | macros/optex/base/optex-tricks.opm | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/macros/optex/base/optex-tricks.opm b/macros/optex/base/optex-tricks.opm index 89fc7dd5e7..456a7472e1 100644 --- a/macros/optex/base/optex-tricks.opm +++ b/macros/optex/base/optex-tricks.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \_undefined {OpTeX tricks ready to autoload <2023-11-15>} % chunks loaded on demand +\_codedecl \_undefined {OpTeX tricks ready to autoload <2024-02-13>} % chunks loaded on demand % Selected OpTeX tricks are here, they are auto-loaded if the macro is used first % namespace: optextrick @@ -97,13 +97,14 @@ \_trick 105 \directoutput ; %%%%%%%%%%% -\_def\directoutput{\_begingroup \_afterassignment\.directoutputA \_setbox0=} +\_newbox\.outbox +\_def\directoutput{\_begingroup \_afterassignment\.directoutputA \_setbox\.outbox=} \_def\.directoutputA{\_aftergroup \.directoutputB} -\_def\.directoutputB{\_preshipout0\_box0 - \_pdfpageheight=\_dimexpr\_ht0+\_dp0+2\_vvkern \_relax - \_pdfpagewidth=\_dimexpr\_wd0+2\_hhkern\_relax +\_def\.directoutputB{\_preshipout\.outbox\_box\.outbox + \_pdfpageheight=\_dimexpr\_ht\.outbox+\_dp\.outbox+2\_vvkern \_relax + \_pdfpagewidth=\_dimexpr\_wd\.outbox+2\_hhkern\_relax \_hoffset=\_hhkern \_voffset=\_vvkern - \_shipout\_box0 + \_shipout\_box\.outbox \_incr\_pageno \_endgroup } @@ -735,12 +736,47 @@ +\_topskip \_relax } +\_trick 0129 \pgforeground ; +%%%%%%%%%%%% + +\_newtoks \pgforeground + +\_addto\_makefootline{ + \_istoksempty\pgforeground \_iffalse + \_vskip-\_prevdepth + \_vskip-\_vsize + \_vskip-\_voffset + \_istoksempty\_footline \_iffalse \_vskip-\_footlinedist \_fi + \_nointerlineskip + \_moveleft\_hoffset \_vbox{\_the\pgforeground} + \_fi +} + +\_trick 0130 \onlyifnew ; +%%%%%%%%%%%% + +\_def \onlyifnew#1#2{\_begingroup% + \_edef\.tmpA{\_csstring #2}% + \_edef\.tmpB{\_string #2}% + \_ea\_ifcsname\.tmpA\_endcsname% + \_ifx\.tmpA\.tmpB% #2 has no backslash + \_def\.onlyifnewA{#1{_optextrick_onlyifnewB}}\_else% + \_def\.onlyifnewA{#1\_optextrick_onlyifnewB}\_fi% + \_else% + \_ifx\.tmpA\.tmpB% + \_def\.onlyifnewA{#1{#2}}\_else% + \_def\.onlyifnewA{#1#2}\_fi% + \_fi\_ea\_endgroup\.onlyifnewA} + +%%%%%%%%%%%% \_trick end ; \_endcode +2024-02-13 \onlyifnew added +2024-02-12 \pgforeground added 2023-11-15 \correctvsize added -2023-11-09 \makeLOF, \makeLOT aded +2023-11-09 \makeLOF, \makeLOT added 2023-11-08 \ispageodd, \seccc added 2023-11-07 \settabs \import \incrpp added 2023-11-05 \twoblocks, \pstart added |