\starttext
\framed[strut=no,offset=0pt,rulethickness=1pt]{%
\framed
[align=normal,
width=200pt,
height=50pt,
offset=0pt,
frame=off,
rulethickness=0pt]{%
\blackrule[color=orange,width=100pt,height=50pt]}}
\stoptext
到目前为止一切都很好。规则的厚度应设置为 0pt,否则即使框架关闭,它也会增加 0.4pt 的间距 - 根据\framedwidth
。不幸的是,我似乎无法添加任何偏移量;这样做会缩小两个框:
\starttext
\framed[strut=no,offset=0pt,rulethickness=1pt]{%
\framed
[align=normal,
width=200pt,
height=50pt,
offset=10pt,
frame=off,
rulethickness=0pt]{%
\blackrule[color=orange,width=100pt,height=50pt]}}
\stoptext
请注意,默认偏移量 2.5ex 似乎工作正常。
\framed[strut=no,offset=0pt,rulethickness=1pt]{%
\framed
[align=normal,
width=200pt,
height=50pt,
frame=off,
rulethickness=0pt]{%
\blackrule[color=orange,width=100pt,height=50pt]}}
预期的输出,就像框架没有嵌套一样:
答案1
使用 时offset
,偏移量是通过缩小内容来增加的。要达到您想要的效果,您必须通过放大内容来增加偏移量。这是使用 键完成的[tblr]offset
。
\starttext
\framed[strut=no,rulethickness=1pt]{%
\framed
[align=normal,
width=200pt,
height=50pt,
toffset=10pt,
boffset=\framedparameter{toffset},
loffset=\framedparameter{toffset},
roffset=\framedparameter{toffset},
frame=off,
rulethickness=0pt]{%
\blackrule[color=orange,width=100pt,height=50pt]}}
\stoptext
您可以使用 中的宏一次设置所有参数extras
。
\define[1]\setouteroffset{%
\setframedparameter{toffset}{#1}%
\setframedparameter{boffset}{#1}%
\setframedparameter{loffset}{#1}%
\setframedparameter{toffset}{#1}%
}
\starttext
\framed[strut=no,rulethickness=1pt]{%
\framed
[align=normal,
width=200pt,
height=50pt,
extras=\setouteroffset{10pt},
frame=off,
rulethickness=0pt]{%
\blackrule[color=orange,width=100pt,height=50pt]}}
\stoptext