我在 Hans Hagen 编写的“cld-mkiv.pdf”手册中找到了此代码。我想在封面中间放一些文字,但我不知道怎么做。我想我需要定义一个覆盖层。
\starttext
\startluacode
local todimen, random = number.todimen, math.random
context.startTEXpage()
local paperwidth = tex.dimen.paperwidth
local paperheight = tex.dimen.paperheight
local nofsteps = 25
local firstcolor = "cyan"
local secondcolor = "white"
context.definelayer(
{ "titlepage" },
)
context.setuplayer(
{ "titlepage" },
{
width = todimen(paperwidth),
height = todimen(paperheight),
}
)
context.setlayerframed(
{ "titlepage" },
{ offset = "-5pt" },
{
width = todimen(paperwidth),
height = todimen(paperheight),
background = "color",
backgroundcolor = firstcolor,
backgroundoffset = "10pt",
frame = "off",
},
""
)
local settings = {
frame = "off",
background = "color",
backgroundcolor = secondcolor,
foregroundcolor = firstcolor,
foregroundstyle = "type",
}
for i=1, nofsteps do
for j=1, nofsteps do
context.setlayerframed(
{ "titlepage" },
{
x = todimen((i-1) * paperwidth /nofsteps),
y = todimen((j-1) * paperheight/nofsteps),
rotation = random(360),
},
settings,
"CLD"
)
end
end
context.tightlayer(
{ "titlepage" }
)
context.stopTEXpage()
return true
\stopluacode
\stoptext