diff --git a/optex/base/margins.opm b/optex/base/margins.opm index fe52a40..d88cc04 100644 --- a/optex/base/margins.opm +++ b/optex/base/margins.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \margins {Macros for margins setting <2023-04-27>} % preloaded in format +\_codedecl \margins {Macros for margins setting <2021-03-15>} % preloaded in format \_doc ---------------------------- \`\margins``/ (,,,)` @@ -36,11 +36,9 @@ \_fi\_fi \_if 1#1\_shiftoffset=0pt \_def\_prepoffsets{}\_else \_if 2#1% double-page layout \_shiftoffset = \_dimexpr \_pgwidth -\_hsize -2\_hoffset \_relax - \_def\_prepoffsets{\_ifodd\_pageno \_else \_advance\_hoffset \_shiftoffset \_fi - \_setpagerightoffset}% + \_def\_prepoffsets{\_ifodd\_pageno \_else \_advance\_hoffset \_shiftoffset \_fi}% \_else \_opwarning{use \_string\_margins/1 or \_string\_margins/2}% \_fi\_fi\_fi - \_setpagerightoffset } \_def\_setpagedimens{\_isnextchar({\_setpagedimensB}{\_setpagedimensA}} \_def\_setpagedimensA#1 {\_ifcsname _pgs:#1\_endcsname @@ -76,28 +74,7 @@ \_public \magscale ; - \_doc ----------------------------- - When left-to-right direction of typesetting is selected (default) then - \"main vertical line" of the page has `\hoffset` distance from the left - paper border and all lines at the page start here and run to the right side - (exceptions can be done by `\moveleft` or `\moveright`, of course). When we - have set right-to-left direction (using `\textdir TRT`, for example), then - the \"main vertical line" is at the same position but lines run to the left, - i.e.\ typically outside the paper. But when `\pagedir TRT` is set too, - then this main vertical line has `\pagerightoffset+1in` distance from the - {\em right} paper border and thus right-to-left lines are visible on the - paper. We have to set `\pagerightoffset` for such cases properly in the - macro \`\_setpagerightoffset`. - It must be called whenever `\hoffset` is changed. - \_cod ----------------------------- - -\_def\_setpagerightoffset{% - \_pagerightoffset=\_dimexpr\_pdfpagewidth-\_xhsize-\_hoffset-1in\_relax -} -\_setpagerightoffset - \_endcode % ----------------------------------------- -2023-04-27 \_setpagerightoffset for TRT typesetting introduced 2021-03-15 \_setxhsize added 2020-03-14 released diff --git a/optex/base/output.opm b/optex/base/output.opm index 5cd2b5a..85cb625 100644 --- a/optex/base/output.opm +++ b/optex/base/output.opm @@ -3,15 +3,11 @@ \_codedecl \nopagenumbers {Output routine <2022-10-20>} % preloaded in format \_doc ----------------------------- - \`\_optexoutput` is the default output routine. You can create another...\nl - The \^`\_preshipout``` used - here behaves similarly like `\setbox` but it does not only copy the box - contents but adds the color literals depending on used attributes. - It is defined using lua code, see section~\ref[lua]. + \`\_optexoutput` is the default output routine. You can create another \_cod ----------------------------- \_output={\_optexoutput} -\_def \_optexoutput{\_begoutput \_preshipout0\_completepage \_shipout\_box0 \_endoutput} +\_def \_optexoutput{\_begoutput \_optexshipout\_completepage \_endoutput} \_doc ----------------------------- Default \`\_begoutput` and \`\_endoutput` is defined. @@ -36,6 +32,23 @@ } \_def \_prepoffsets {} + \_doc ----------------------------- + The \`\_optexshipout` does similar work like the `\_shipout` primitive. + The color literals are added to the `\box0` using + the \^`\_preshipout``` pseudo-primitive. + It is defined using lua code, see section~\ref[lua]. + Finally the `\_shipout` primitive is used. We want to use `\hoffset` + value and not `\pagerightoffset` during shipout, so the `\pagedirection` + is set to zero. If a user sets different value in the document, + it is irrelevant for this `\shipout` process. + \_cod ----------------------------- + +\_def \_optexshipout #1{% + \_setbox0=\_completepage + \_preshipout0\_box0 + \_pagedirection=0 \_shipout\_box0 +} + \_doc ----------------------------- The `\hsize` value can be changed at various places in the document but we need to have a constant value \`\_xhsize` in the output routine @@ -258,6 +271,7 @@ The output routine \^`\_optexoutput` is similar as in plain \TeX. It does: \_endinput +2022-04-28 \_optexoutput introduced 2022-10-22 \_normalbaselines added to \makehead/foot/line 2022-03-07 \_resetattrs instead \_resetcolor 2021-07-16 output routine supports colors via attributes