diff --git a/optex/base/margins.opm b/optex/base/margins.opm index d88cc04..b21b1cf 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 <2021-03-15>} % preloaded in format +\_codedecl \margins {Macros for margins setting <2023-04-29>} % preloaded in format \_doc ---------------------------- \`\margins``/ (,,,)` @@ -36,9 +36,11 @@ \_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}% + \_def\_prepoffsets{\_ifodd\_pageno \_else \_advance\_hoffset \_shiftoffset \_fi + \_setpagerightoffset}% \_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 @@ -74,7 +76,28 @@ \_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" cannot be at the same position because lines run to the left, + i.e.\ they would be off paper. This is reason why the setting `\pagedir TRT` shifts the + \"main vertical line" to an alternative position: it 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` properly for such cases. This is + done in the macro \`\_setpagerightoffset`. + It must be called whenever `\hoffset` is changed. + \_cod ----------------------------- + +\_def\_setpagerightoffset{% + \_pagerightoffset=\_dimexpr\_pdfpagewidth-\_xhsize-\_hoffset-1in\_relax +} +\_setpagerightoffset % setting default value from default values + \_endcode % ----------------------------------------- +2023-04-29 \_setpagerightoffset for TRT typesetting introduced again 2021-03-15 \_setxhsize added 2020-03-14 released diff --git a/optex/base/output.opm b/optex/base/output.opm index 64848c9..5e47657 100644 --- a/optex/base/output.opm +++ b/optex/base/output.opm @@ -37,17 +37,10 @@ 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 `\pagedir` - and `\box0` are set to TLT. If a user sets different value of `\pagedir` - in the document, it is irrelevant for this `\shipout` process. + Finally the `\_shipout` primitive is used. \_cod ----------------------------- -\_def \_optexshipout #1{% - \_setbox0=\_completepage - \_preshipout0\_box0 - \_pagedirection=0 \_boxdirection0=0 \_shipout\_box0 -} +\_def \_optexshipout #1{\_setbox0=#1\_preshipout0\_box0 \_shipout\_box0 } \_doc ----------------------------- The `\hsize` value can be changed at various places in the document but