如何为Typst的figure图片添加边框?
给Typst的Figure添加细黑色边框
因为figure本身没有内置的border参数,你可以通过以下两种方法实现需求:
方法一:用
box包裹图像内容
在figure内部,把图像(或其他内容)放进box组件中,给box设置边框属性即可:figure( caption: "带细黑边框的示例图", box( border: (width: 0.5pt, color: black), image("example.png", width: 100%), ), )其中
width: 0.5pt控制边框粗细,color: black定义边框颜色,可根据需求调整数值。方法二:全局统一设置figure边框
若要给所有figure自动添加边框,可通过set figure结合decorator实现全局配置:set figure(decorator: box.with(border: (width: 0.5pt, color: black))) figure( caption: "全局统一边框的图", image("example.png", width: 100%), )该设置会作用于后续所有
figure,无需逐个单独配置。
内容的提问来源于stack exchange,提问作者mcmuffin6o
相关产品推荐
相关产品推荐

