I have defined the following layout in my own module, which may have some
inspiration for your needs.
%%%%%%%%%%%%%%%%
% must load font first, then can get real text fontsize(1em)
% Only care about the width of each row, the height of each column and the
width of the side note.
% Others are cut according to the ratio of 1:√2 (only rough)
%%%%%%%%%%%%%%%%
% If the layout is not set in the module, \c_textcount \c_heightcount
\c_margincount must be set in advance.
\unprotect
\newcount\c_textcount \c_textcount=40\relax % Modify to the required
number of words per line
\newcount\c_heightcount \c_heightcount=45\relax %Modify to the required
number of lines in the text
\newcount\c_margincount \c_margincount=10\relax % Modify to the number of
words required for each line in the side note area
\newdimen\d_textfontsize \d_textfontsize=\fontdimen6\font\relax
\newdimen\d_marginwidth
\d_marginwidth=\dimexpr\fontdimen6\font*\c_margincount\relax
\newdimen\d_textlineheight\d_textlineheight=
\dimexpr\baselineskip*\c_heightcount-\baselineskip+
\ifdim\topskip<\ht\strutbox\topskip\else\ht\strutbox\fi\relax
\protect
\startluacode
local todimen
local pw = tex.getdimen("paperwidth")
local ph = tex.getdimen("paperheight")
local pr = pw / ph
local tc = tex.getcount("c_textcount")
local hc = tex.getcount("c_heightcount")
local mc = tex.getcount("c_margincount")
local bs = tex.getdimen("d_textfontsize")
local hh = tex.getdimen("d_textlineheight")
local mw = tex.getdimen("d_marginwidth")
local twr = tc * bs -- The number of words per line is necessary to set.
if hc == 0 then -- If the page height is not set
thr = twr / pr
else
thr = hh
end
local Rm = (pw - twr) / (1 + pr) -- right total
local Rmr = Rm * pr / (2 + pr + 1/pr) -- edge distance
local Rml = Rmr / pr -- margin distance
local Lm = pw - Rm - twr -- left total
if mc == 0 then
Rmm = Rm -Rml -Rmr -- margin text width
else
Rmm = mw
Rmr = (Rm - Rmm) / (1 + pr)
Rml = Rm - Rmm - Rmr
end
local He = (ph - thr) / (1 + pr) -- top total
local Fo = ph - He - thr -- bot total
local Het = He * pr / (2 + pr + 1/pr) -- top distance
local Heb = Het / pr -- header distance
local Hem = He - Het - Heb -- header height
local Fob = Fo * pr / (2 + pr + 1/pr)
local Fot = Fob / pr
local Fom = Fo - Fot -Fob
textwidth = tostring(twr/65536) .. "pt"
textheight = ph - Het - Fob -- textheight 是 Page - Top - Tail
textheight = tostring(textheight/65536) .. "pt"
backspace = tostring(Lm/65536) .. "pt"
rightmargin = tostring(Rmm/65536) .. "pt"
rightmargindistance = tostring(Rml/65536) .. "pt"
rightedgedistance = tostring(Rmr/65536) .. "pt"
topdistance = tostring(Het/65536) .. "pt"
header = tostring(Hem/65536) .. "pt"
headerdistance = tostring(Heb/65536) .. "pt"
footer = tostring(Fom/65536) .. "pt"
footerdistance = tostring(Fot/65536) .. "pt"
botdistance = tostring(Fob/65536) .. "pt"
-- context(ph/65536)context.par()
-- context("he ")context(He/65536)context.par()
-- context("het ")context(Het/65536)context.par()
-- context("hem ")context(Hem/65536)context.par()
-- context("heb ")context(Heb/65536)context.par()
-- context("fo ")context(Fo/65536)context.par()
-- context("fot ")context(Fot/65536)context.par()
-- context("fom ")context(Fom/65536)context.par()
-- context("fob ")context(Fob/65536)context.par()
-- context(thr/65536)context.par()
-- context(textheight)context.par()
context.definelayout(
{ "hermes" },
{
width=textwidth,
backspace=backspace,
rightmargin=rightmargin,
rightmargindistance=rightmargindistance,
rightedgedistance=rightedgedistance,
topspace=topdistance,
header=header,
headerdistance=headerdistance,
footer=footer,
footerdistance=footerdistance,
bottomspace=botdistance,
height=textheight,
}
)
\stopluacode
%%%%%%%
Then you can set it to \setuplayout[hermes],
If the current layout does not meet the requirements,
it can also be modified later.
autumnus
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________