If I put a variable into $binom(#a ,#b )$ it raises the error “expected content, foud interger”.
Follow the example:
#let triangle(n) = (
for i in range(0,n)
[#align(
center,
block[
#for c in range(0,i +1) [
#box(
$binom(#i,#c)$
)
#h(1em)
]
]
)
]
)
if I put the variables inside the error disappear but the number is printed inside .
addeding “” before the first parameter the error disappear:
#let triangle1(n) = (
for i in range(0,n)
[#align(
center,
block[
#for c in range(0,i +1) [
#box(
$binom(""#i,#c)$
)
#h(1em)
]
]
)
]
)
Wrap i
and c
with str
to convert them strings.
Also, you can call math.binom
to avoid extra $$.
#let triangle(n) = (
for i in range(0, n) {
align(
center,
block(for c in range(0, i + 1) {
box(math.binom(str(i), str(c)))
h(1em)
}),
)
}
)
#triangle(5)
1 Like
PgBiel
October 21, 2024, 4:02pm
4
Hey @voyager ! I’ve moved your post to the better-suited Questions category. In addition, I’ve changed the title of your post to better reflect our guidelines for question posts: How to post in the Questions category
Make sure your post title is a question you’d ask to a friend about Typst.
In addition, if @ParaN3xus ’s answer helped you, consider marking it as the solution!