Irregularity in a topspace a bottomspace?
![](https://secure.gravatar.com/avatar/af13db75aa1c24fee635c74fecf93090.jpg?s=120&d=mm&r=g)
Hi all. I was surprised that when I set up (in the MKII and MKIV too) topspace parameter to a nonzero value and the value of the bottomspace parameter to zero value, then the size of bottomspace is the same as topspace size. On the other side, if I set topspace to zero value and the bottomspace to nonzero value, ConTeXt behaves as I expected. Is this a normal behavior ConTeXt? Ie. when bottomspace is zero, then the paper has only the tops and not bottoms? Thanx Jaroslav My minimal example (watch showlayout): 1. topspace is nonzero, bottomspace is zero value: \setuplayout[ backspace=0cm, leftmargin=0cm, width=fit, rightmargin=0cm, cutspace=0cm, topspace=2cm, headerdistance=0cm, header=0cm, height=fit, footerdistance=0cm, footer=0cm, bottomspace=0cm ] \starttext \showlayout \input tufte \stoptext 2. topspace is nonzero, bottomspace is nonzero value too: \setuplayout[ backspace=0cm, leftmargin=0cm, width=fit, rightmargin=0cm, cutspace=0cm, topspace=2cm, headerdistance=0cm, header=0cm, height=fit, footerdistance=0cm, footer=0cm, bottomspace=1cm ] \starttext \showlayout \input tufte \stoptext 3. topspace is zero, bottomspace is nonzero value: \setuplayout[ backspace=0cm, leftmargin=0cm, width=fit, rightmargin=0cm, cutspace=0cm, topspace=0cm, headerdistance=0cm, header=0cm, height=fit, footerdistance=0cm, footer=0cm, bottomspace=1cm ] \starttext \showlayout \input tufte \stoptext
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
Am 11.06.10 07:45, schrieb Jaroslav Hajtmar:
Hi all. I was surprised that when I set up (in the MKII and MKIV too) topspace parameter to a nonzero value and the value of the bottomspace parameter to zero value, then the size of bottomspace is the same as topspace size. On the other side, if I set topspace to zero value and the bottomspace to nonzero value, ConTeXt behaves as I expected. Is this a normal behavior ConTeXt? Ie. when bottomspace is zero, then the paper has only the tops and not bottoms?
When you set 'width=fit' or 'width=middle' context looks at the bottomspace value and if the bottomspace height is 0pt it assign to the bottomspace the height of the topspace. The only thing you can do it to assign a domension ti height, e.g. 'height=15cm'. @Hans: How about a 'height=auto' key which calculates the textheight like 'height=middle' but doen't change the bottomspace value even if the value is 0pt? Wolgang
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
Am 11.06.10 07:45, schrieb Jaroslav Hajtmar:
Hi all. I was surprised that when I set up (in the MKII and MKIV too) topspace parameter to a nonzero value and the value of the bottomspace parameter to zero value, then the size of bottomspace is the same as topspace size. On the other side, if I set topspace to zero value and the bottomspace to nonzero value, ConTeXt behaves as I expected. Is this a normal behavior ConTeXt? Ie. when bottomspace is zero, then the paper has only the tops and not bottoms?
As told in my other mail that's not possible with a calculated text height but here is a patch: \unprotected\def\dorecalculatelayout {%\the\everybeforelayout \setups[\layoutparameter\c!preset]% \global\leftmarginwidth \layoutparameter\c!leftmargin \global\rightmarginwidth\layoutparameter\c!rightmargin \global\leftedgewidth \layoutparameter\c!leftedge \global\rightedgewidth \layoutparameter\c!rightedge \global\headerheight \layoutparameter\c!header \global\footerheight \layoutparameter\c!footer \global\bottomheight \layoutparameter\c!bottom \global\topheight \layoutparameter\c!top \global\backspace \layoutparameter\c!backspace \global\topspace \layoutparameter\c!topspace \setlayoutdimensions % the rest of the `dimensions' \docheckgridsnapping \doprocesslocalsetups{\layoutparameter\c!setups}% depends on gridsnapping ! \simplesetupwhitespace \simplesetupblank \setupinterlinespace[\v!reset]% \synchronizegloballinespecs \global\cutspace\layoutparameter\c!cutspace \relax \doifelse{\layoutparameter\c!width}\v!middle {\ifdim\cutspace=\zeropoint \global\cutspace\backspace \fi \global\makeupwidth\dimexpr\paperwidth-\backspace-\cutspace\relax} {\doifelse{\layoutparameter\c!width}\v!auto {\global\makeupwidth\dimexpr\paperwidth-\backspace-\cutspace\relax} {\doifelse{\layoutparameter\c!width}\v!fit {\ifdim\cutspace=\zeropoint \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\advance\makeupwidth\dimexpr -\rightmargindistance-\rightmarginwidth -\rightedgedistance -\rightedgewidth -\scratchdimen\relax} {\global\makeupwidth\layoutparameter\c!width\relax \ifdim\cutspace=\zeropoint \global\cutspace\dimexpr\paperwidth-\makeupwidth-\backspace\relax % \else % A kind of inconsistent specification, but used % in for instance s-pre-19.tex; the cutspace is % used only for determining some kind of right % margin; don't use this in doublesided mode \fi}}}% \scratchdimen\layoutparameter\c!bottomspace\relax %\ifdim\scratchdimen=\zeropoint % \scratchdimen\topspace %\fi \global\bottomspace\layoutparameter\c!bottomspace\relax \global\layoutlines0\number\layoutparameter\c!lines\relax % may be empty \ifcase\layoutlines \doifelse{\layoutparameter\c!height}\v!middle {\ifdim\bottomspace=\zeropoint \global\bottomspace\topspace \fi \global\makeupheight\dimexpr\paperheight-\topspace-\bottomspace\relax} {\doifelse{\layoutparameter\c!height}\v!auto {\global\makeupheight\dimexpr\paperheight-\topspace-\bottomspace\relax} {\doifelse{\layoutparameter\c!height}\v!fit {\ifdim\bottomspace=\zeropoint \global\bottomspace\topspace \fi \global\makeupheight\dimexpr\paperheight-\bottomspace\relax \scratchdimen\dimexpr\topspace-\topheight-\topdistance\relax \ifdim\scratchdimen<\zeropoint \scratchdimen\zeropoint \fi \global\advance\makeupheight\dimexpr-\bottomdistance-\bottomheight-\scratchdimen\relax} {\global\makeupheight\layoutparameter\c!height\relax \ifdim\bottomspace=\zeropoint \global\bottomspace\dimexpr\paperheight-\makeupheight-\topspace\relax \else % inconsistent specification \fi}}}% \else % beware, when the bodyfont changes (switched) this will change as well; implementing % a global lineheight is tricky: should we take the bodyfont interlinespace or the one set % independent of the bodyfont (before or after a layout spec); way too fuzzy, so we % stick to the current method (after a night of experimenting ...2003/10/13) \global\makeupheight\dimexpr \layoutparameter\c!lines\lineheight-\strutheight+\topskip+ \headerdistance+\headerheight+\footerdistance+\footerheight\relax \fi \backoffset\layoutparameter\c!horoffset \topoffset \layoutparameter\c!veroffset \global\setdimentoatleast\makeupwidth\onepoint \global\setdimentoatleast\makeupheight \onepoint % \checkcurrentlayout % here ? % \the\everyafterlayout \calculatelayoutextras \calculatehsizes \calculatevsizes \calculatepseudocolumns \recalculatebackgrounds} \definelayout[middleheight][topspace=4cm,bottomspace=0cm,height=middle] \definelayout[autoheight] [topspace=4cm,bottomspace=0cm,height=auto] \definelayout[middlewidth] [backspace=4cm,cutspace=0cm,width=middle] \definelayout[autowidth] [backspace=4cm,cutspace=0cm,width=auto] \setuppapersize[A4][A3]\setuplayout[location=middle] \showframe \starttext \setuplayout[middleheight]\page[empty] \setuplayout[autoheight] \page[empty] \setuplayout[reset] \page[empty] \setuplayout[middlewidth] \page[empty] \setuplayout[autowidth] \page[empty] \setuplayout[reset] \page[empty] \stoptext Wolfgang
![](https://secure.gravatar.com/avatar/af13db75aa1c24fee635c74fecf93090.jpg?s=120&d=mm&r=g)
Ok. Thanx. I see that you are due my ignorance revealed a problem that I did not report :-) Jaroslav Dne 11.6.2010 11:50, Wolfgang Schuster napsal(a):
Am 11.06.10 07:45, schrieb Jaroslav Hajtmar:
Hi all. I was surprised that when I set up (in the MKII and MKIV too) topspace parameter to a nonzero value and the value of the bottomspace parameter to zero value, then the size of bottomspace is the same as topspace size. On the other side, if I set topspace to zero value and the bottomspace to nonzero value, ConTeXt behaves as I expected. Is this a normal behavior ConTeXt? Ie. when bottomspace is zero, then the paper has only the tops and not bottoms?
As told in my other mail that's not possible with a calculated text height but here is a patch:
\unprotected\def\dorecalculatelayout {%\the\everybeforelayout \setups[\layoutparameter\c!preset]% \global\leftmarginwidth \layoutparameter\c!leftmargin \global\rightmarginwidth\layoutparameter\c!rightmargin \global\leftedgewidth \layoutparameter\c!leftedge \global\rightedgewidth \layoutparameter\c!rightedge \global\headerheight \layoutparameter\c!header \global\footerheight \layoutparameter\c!footer \global\bottomheight \layoutparameter\c!bottom \global\topheight \layoutparameter\c!top \global\backspace \layoutparameter\c!backspace \global\topspace \layoutparameter\c!topspace \setlayoutdimensions % the rest of the `dimensions' \docheckgridsnapping \doprocesslocalsetups{\layoutparameter\c!setups}% depends on gridsnapping ! \simplesetupwhitespace \simplesetupblank \setupinterlinespace[\v!reset]% \synchronizegloballinespecs \global\cutspace\layoutparameter\c!cutspace \relax \doifelse{\layoutparameter\c!width}\v!middle {\ifdim\cutspace=\zeropoint \global\cutspace\backspace \fi \global\makeupwidth\dimexpr\paperwidth-\backspace-\cutspace\relax} {\doifelse{\layoutparameter\c!width}\v!auto
{\global\makeupwidth\dimexpr\paperwidth-\backspace-\cutspace\relax} {\doifelse{\layoutparameter\c!width}\v!fit {\ifdim\cutspace=\zeropoint \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\advance\makeupwidth\dimexpr -\rightmargindistance-\rightmarginwidth -\rightedgedistance -\rightedgewidth -\scratchdimen\relax} {\global\makeupwidth\layoutparameter\c!width\relax \ifdim\cutspace=\zeropoint
\global\cutspace\dimexpr\paperwidth-\makeupwidth-\backspace\relax % \else % A kind of inconsistent specification, but used % in for instance s-pre-19.tex; the cutspace is % used only for determining some kind of right % margin; don't use this in doublesided mode \fi}}}% \scratchdimen\layoutparameter\c!bottomspace\relax %\ifdim\scratchdimen=\zeropoint % \scratchdimen\topspace %\fi \global\bottomspace\layoutparameter\c!bottomspace\relax \global\layoutlines0\number\layoutparameter\c!lines\relax % may be empty \ifcase\layoutlines \doifelse{\layoutparameter\c!height}\v!middle {\ifdim\bottomspace=\zeropoint \global\bottomspace\topspace \fi
\global\makeupheight\dimexpr\paperheight-\topspace-\bottomspace\relax} {\doifelse{\layoutparameter\c!height}\v!auto
{\global\makeupheight\dimexpr\paperheight-\topspace-\bottomspace\relax} {\doifelse{\layoutparameter\c!height}\v!fit {\ifdim\bottomspace=\zeropoint \global\bottomspace\topspace \fi \global\makeupheight\dimexpr\paperheight-\bottomspace\relax
\scratchdimen\dimexpr\topspace-\topheight-\topdistance\relax \ifdim\scratchdimen<\zeropoint \scratchdimen\zeropoint \fi
\global\advance\makeupheight\dimexpr-\bottomdistance-\bottomheight-\scratchdimen\relax}
{\global\makeupheight\layoutparameter\c!height\relax \ifdim\bottomspace=\zeropoint
\global\bottomspace\dimexpr\paperheight-\makeupheight-\topspace\relax \else % inconsistent specification \fi}}}% \else % beware, when the bodyfont changes (switched) this will change as well; implementing % a global lineheight is tricky: should we take the bodyfont interlinespace or the one set % independent of the bodyfont (before or after a layout spec); way too fuzzy, so we % stick to the current method (after a night of experimenting ...2003/10/13) \global\makeupheight\dimexpr \layoutparameter\c!lines\lineheight-\strutheight+\topskip+ \headerdistance+\headerheight+\footerdistance+\footerheight\relax \fi \backoffset\layoutparameter\c!horoffset \topoffset \layoutparameter\c!veroffset \global\setdimentoatleast\makeupwidth\onepoint \global\setdimentoatleast\makeupheight \onepoint % \checkcurrentlayout % here ? % \the\everyafterlayout \calculatelayoutextras \calculatehsizes \calculatevsizes \calculatepseudocolumns \recalculatebackgrounds}
\definelayout[middleheight][topspace=4cm,bottomspace=0cm,height=middle] \definelayout[autoheight] [topspace=4cm,bottomspace=0cm,height=auto]
\definelayout[middlewidth] [backspace=4cm,cutspace=0cm,width=middle] \definelayout[autowidth] [backspace=4cm,cutspace=0cm,width=auto]
\setuppapersize[A4][A3]\setuplayout[location=middle]
\showframe
\starttext
\setuplayout[middleheight]\page[empty] \setuplayout[autoheight] \page[empty] \setuplayout[reset] \page[empty]
\setuplayout[middlewidth] \page[empty] \setuplayout[autowidth] \page[empty] \setuplayout[reset] \page[empty]
\stoptext
Wolfgang
participants (2)
-
Jaroslav Hajtmar
-
Wolfgang Schuster