\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