I think for the width=fit setup,the makeupwidth should be :
paperwidth - [ max of( backspace , leftmargin +leftmargindis+leftedge+leftedegedis)]- cutspace
(leftmargin +leftmargindis+leftedge+leftedegedis) is the subdimmensions of backspace.
For the height=fit setup,the makeupheight should be :
paperheight - [ max of( topspace , top+topdistance)]- bottomspace
In the page-lay.mkxl file , if not set the bottomspace,it is set equal to topspace .
if not set the cutspace,it is set equal to backspace .
but the implementation in page-lay.mkxl file ,for the makeupwidth , the subdimmensions of cutspace have been subtracted in code line(first calc step):
> \global\makeupwidth\dimexpr\paperwidth-\cutspace\relax
so the subdimmensions of cutspace should not be subtracted again in line
> \global\advanceby\makeupwidth\dimexpr
> -\rightmargindistance-\rightmarginwidth
> -\rightedgedistance-\rightedgewidth
> -\scratchdimen\relax
the scratchdimen is the difference between backspace and it's subdimmensions ,not the sum of it's subdimmensions.
There is the same problem for makeupheight calculation,but the error is more then the makeupwidth.
Build this tex file,you can see the footer is obviously pushed to the pap
edge, and the footer is narrower than expected.
------------------ 原始邮件 ------------------
发件人:Hans Hagen via ntg-context "ntg-context@ntg.nl"
时 间:2025/01/11 07:31:47 周六
收件人:ntg-context@ntg.nl
抄送人:Hans Hagen "j.hagen@freedom.nl"
主 题:[NTG-context] Re: about : setuplayout[width=fit or height=fit]
On 1/10/2025 9:28 AM, wangzhongtian wrote:
> hi,hans ,
>
> Maybe I find some bug in file page-lay.mkxl, in
> \def\page_layouts_synchronize.
>
> 1. Here is the source code snippet from the above code file. I think it
> is reasonable if change the last line of code to:
>
> \global\advanceby\makeupheight\dimexpr-\topdistance-\topheight-
> \scratchdimen\relax
>
> \orelse\ifx\p_page_layouts_height\v!fit
> \ifzeropt\bottomspace
> \global\bottomspace\topspace
> \fi
> \global\makeupheight\dimexpr\paperheight-\bottomspace\relax
> \scratchdimen\dimexpr\topspace-\topheight-\topdistance\relax
> \ifdim\scratchdimen<\zeropoint
> \scratchdimen\zeropoint
> \fi
> \global\advanceby\makeupheight\dimexpr-\bottomdistance-\bottomheight-
> \scratchdimen\relax
you mean
\global\advanceby\makeupheight
\dimexpr-\bottomdistance-\bottomheight-\scratchdimen\relax
becomes
\global\advanceby\makeupheight
\dimexpr-\topdistance-\topheight-\scratchdimen\relax
but the top values are actually in scratchdimen so
\global\advanceby\makeupheight
\dimexpr-\topdistance-\topheight-\topspace-\topheight-\topdistance\relax
or
\global\advanceby\makeupheight
\dimexpr-2\topdistance-2\topheight-\topspace\relax
which is wrong, so the question is: what is the issue you try to fix
> 2. Here is the source code snippet from above code file. I think it is
> reasonable if change the last line of code to:
>
> \global\advanceby\makeupwidth\dimexpr
> -\leftmargindistance-\leftmarginwidth
> -\leftedgedistance -\leftedgewidth
> -\scratchdimen\relax
>
> \orelse\ifx\p_page_layouts_width\v!fit
> \ifzeropt\cutspace
> \global\cutspace\backspace
> \fi
> \global\makeupwidth\dimexpr\paperwidth-\cutspace\relax
> \scratchdimen\dimexpr\backspace
> -\leftedgewidth-\leftedgedistance
> -\leftmarginwidth-\leftmargindistance\relax
> \ifdim\scratchdimen<\zeropoint
> \scratchdimen\zeropoint
> \fi
>
> \global\advanceby\makeupwidth\dimexpr
>
> -\rightmargindistance-\rightmarginwidth
>
> -\rightedgedistance-\rightedgewidth
> -\scratchdimen\relax
>
>
> ----------------------------
>
> zhongtian wang
>
> Shijiazhuang YouWen Information Technology Co.,Ltd,China
>
> 13311202589 wangzht@189.cn
>