我刚刚遇到一个问题:我为定理定义了一个随机背景(我只是复制粘贴了在网上找到的 MP 部分的代码,因为我不是 metapost 的用户;可以找到 Aditya 的这样一个定义的例子这里)。但是,当我将其与侧浮一起使用时,框架根本不考虑这一点:
\useexternalfigure[ctanlion][http://www.ctan.org/lion/ctan_lion_350x350.png][width=5cm]
\startuseMPgraphic{background:random}
path p;
for i = 1 upto nofmultipars :
p = (multipars[i] topenlarged 0pt bottomenlarged 0pt) randomized 3pt ;
fill p withcolor 0.95white ;
draw p withcolor black withpen pencircle scaled \MPvar{linewidth};
endfor;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic
\definetextbackground[axiomframe]
[mp=background:random,
location=paragraph,
rulethickness=1pt,
width=local,
leftoffset=.5\bodyfontsize,rightoffset=.5\bodyfontsize,
topoffset=.5\bodyfontsize,bottomoffset=.5\bodyfontsize,
before={\testpage[3]\blank},
after={\blank[2*medium]},
]
\definedescription[theorem]
[text=,
before={\setupnarrower[middle=1cm]\startnarrower\startaxiomframe},
after={\stopaxiomframe\stopnarrower},
title=yes,
titlestyle=bold,
alternative=top,
inbetween=\nowhitespace]
\starttext
\starttheorem{Test}
In this theorem, we test the background behavior. It seems to be alright for text, not
for background.
\stoptheorem
\placefigure[right,none]{}{\externalfigure[ctanlion]}
In order to test the behavior in cas of side floats, we need a picture.
Let me introduce you the glorious CTAN lion :
\starttheorem{CTAN Lion}
The CTAN Lion is very useful for tests. In this case, we can see that the background is
not consistent with the figure, while the text is consistent.
\stoptheorem
The complex case is the one of very long text :
\placefigure[right,none]{}{\externalfigure[ctanlion]}
\starttheorem{Long blabla}
\input knuth
\stoptheorem
\stoptext
理想情况下,我想要: - 如果在定理之前插入侧浮点数,则框架缩小到正确的大小,并且文本始终保持这个大小 - 如果定理太长,我选择在定理框架之前刷新侧浮点数/在定理框架内插入浮点数(效果很好)
先感谢您
答案1
我认为让侧浮点遵守定理的缩减段落并非易事。我也不认为让定理决定是否清除侧浮点或将其考虑在内(这与问题 1 相同)并非易事。
但是,您可以使用 清除定理环境之前的所有侧浮点数\flushsidefloats
。
\useexternalfigure
[ctanlion]
[http://www.ctan.org/lion/ctan_lion_350x350.png]
[width=5cm]
\startuseMPgraphic{background:random}
path p;
for i = 1 upto nofmultipars :
p = (multipars[i] topenlarged 0pt bottomenlarged 0pt) randomized 3pt ;
fill p withcolor 0.95white ;
draw p withcolor black withpen pencircle scaled \MPvar{linewidth};
endfor;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic
\definetextbackground
[axiomframe]
[
mp=background:random,
location=paragraph,
rulethickness=1pt,
width=local,
leftoffset=.5\bodyfontsize,rightoffset=.5\bodyfontsize,
topoffset=.5\bodyfontsize,bottomoffset=.5\bodyfontsize,
before={\testpage[3]\blank},
after={\blank[2*medium]},
]
\definedescription
[theorem]
[
text=,
before={\flushsidefloats
\setupnarrower[middle=1cm]\startnarrower\startaxiomframe},
after={\stopaxiomframe\stopnarrower},
title=yes,
titlestyle=bold,
alternative=top,
inbetween=\nowhitespace,
]
\starttext
\starttheorem{Test}
In this theorem, we test the background behavior. It seems to be
alright for text, not for background.
\stoptheorem
\placefigure[right,none]{}{\externalfigure[ctanlion]}
In order to test the behavior in cas of side floats, we need a
picture. Let me introduce you the glorious CTAN lion :
\starttheorem{CTAN Lion}
The CTAN Lion is very useful for tests. In this case, we can see
that the background is not consistent with the figure, while the
text is consistent.
\stoptheorem
The complex case is the one of very long text :
\placefigure[right,none]{}{\externalfigure[ctanlion]}
\starttheorem{Long blabla}
\input knuth
\stoptheorem
\stoptext