% Set binding correction value (mode=BCOR turns it on). \doifmodeelse{BCOR}{\def\bindingcorr{5mm}}{\def\bindingcorr{0pt}} % Set visible page width. \newdimen\PageWidth \PageWidth=\dimexpr(\paperwidth-\bindingcorr) % Determine the paper aspect ratio. \edef\Ratio{\withoutpt{\the\dimexpr(2\paperheight/(\PageWidth/32768))}} % Set the textarea width to 2.6 alphabets. \setbox\scratchbox\hbox{\dorecurse{26}{\character\recurselevel}} \newdimen\Width \Width=\dimexpr(2.6\wd\scratchbox) % Set the textarea height proportional to the width. \newdimen\Height \Height=\dimexpr(\Ratio\Width) % Set the margin/gutter widths to be equal on a full spread. \newdimen\Back \doifmodeelse{oneside} {\Back=\dimexpr(((\PageWidth - \Width) / 2) + \bindingcorr)} {\Back=\dimexpr(((\PageWidth - \Width) / 3) + \bindingcorr)} % Set the top and bottom margins in a 1:2 ratio, ignoring headers. \edef\Top{\the\dimexpr((\paperheight - \Height) / 3 - 3\lineheight)} % Redefine \Height to include header and footer space. \Height=\dimexpr(\Height + 8\lineheight) % Set up the page layout using the calculated parameters. \setuplayout[ backspace=\the\Back, height=\the\Height, width=\the\Width, header=2\lineheight, headerdistance=\lineheight, footer=2\lineheight, footerdistance=0\lineheight, topspace=\Top, ] \setupheader[][state=none] \setuppagenumbering[alternative=doublesided, location={footer}] \enablemode[BCOR] \starttext \framed[width=\textwidth,height=\textheight]{} \input tufte \stoptext