gpt4 book ai didi

Side brackets next to a vector in Typst(Typst中向量旁边的方括号)

转载 作者:bug小助手 更新时间:2023-10-24 21:27:10 26 4
gpt4 key购买 nike



Is there a way to add brackets next to a vector in typst?

在类型转换中,有没有办法在向量旁边加括号?


enter image description here


This post explains how to do it in Latex: https://tex.stackexchange.com/questions/331506/how-to-put-more-than-one-side-braces-for-a-vector

这篇文章解释了如何用Latex:https://tex.stackexchange.com/questions/331506/how-to-put-more-than-one-side-braces-for-a-vector来做这件事


更多回答
优秀答案推荐

You can use the #stack() function, similar to the LaTeX solution, and put it next to your vector. You can then use #lr() to scale a single closing } delimiter. Depending on the content of your vector, you will have to play around with the sizes. It is possible to measure the sizes needed with the #measure() function but it might be more prone to break.

您可以使用#STACK()函数,类似于LaTeX解决方案,并将其放在向量的旁边。然后,您可以使用#lr()来缩放单个结束}分隔符。根据矢量内容的不同,您将不得不调整大小。可以使用#measure()函数测量所需的大小,但它可能更容易出错。


Manual solution:


$
bold(upright(x)) = vec(x_1, dots.v, x_(n_1), x_(n_1 + 1), dots.v, x_n)
#stack(dir: ttb, spacing: 1em, $ lr(}, size: #350%) n_1$, $ lr(}, size: #350%) n_2$)
$

Automated (measure) solution:


#let side-bracket(inp, br1, br2) = style(styles => {
let half-height = measure(inp, styles).height / 2
$
inp
#stack(dir: ttb, spacing: 1em, $ lr(}, size: #half-height) #br1$, $ lr(}, size: #half-height) #br2$)
$
})

#side-bracket($ bold(upright(x)) = vec(x_1, dots.v, x_(n_1), x_(n_1 + 1), dots.v, x_n) $, $n_1$, $n_2$)


Yes, that is quite easy with Typst:

是的,这对于Typst来说非常简单:


$ vec(x_1, dots.v, x_n,
x_(n+1), dots.v,
delim: "{"
)
#stack(
$ lr(} #v(3em)) n_1 $,
0.5em,
$ lr(} #v(2em)) n_2 $
)
$

Will produce approximately this result: (rendered by Discord bot) (can't insert images directly, my first answer there).

将产生这样的结果:(由不一致机器人渲染)(不能直接插入图像,我的第一个答案是)。


The idea is roughly the same as in LaTeX, using stack near the vector with appropriate spacing. Instead of lots of new lines you can use vertical spacing (#v(3em) is roughly the same as "three lines"). lr there is used to stretch the left delimiter (}) to all height of #v(...), and n is placed in it's center by default.

其想法与LaTeX中的大致相同,在矢量附近使用堆栈,并具有适当的间距。您可以使用垂直间距来代替大量的新行(#v(3em)大致等同于“三行”)。Lr用于将左定界符(})拉伸到#v(...)的所有高度,默认情况下将n放在它的中心。


It is quite easy to modify that example to whatever you want, the idea is pretty simple.

可以很容易地将该示例修改为您想要的任何内容,其思想非常简单。


更多回答

Thanks! This solution almost worked for me, but the vector and the brackets where very far apart and it added an equation number for each line.

谢谢!这个解决方案对我来说几乎是有效的,但向量和括号相距很远,它为每一行添加了一个方程式编号。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com