Skip to content

Commit 893c284

Browse files
committed
add given width and fig align
1 parent 4823d05 commit 893c284

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

lib.typ

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#import "@preview/wrap-it:0.1.0": wrap-content
22

3-
#let task = (given: "", find: "", stroke: "partially", fig: none, body) => {
3+
#let task = (given: "", find: "", stroke: "partially", fig: none, fig-align: top + right, given-width: auto, body) => {
44
grid(
5-
columns: (auto, auto),
5+
columns: (given-width, auto),
66
column-gutter: 1.2em,
77

88
table(
@@ -26,7 +26,7 @@
2626
}
2727
},
2828

29-
given,
29+
given,
3030
if find != "" {
3131
find
3232
}
@@ -37,12 +37,18 @@
3737
body
3838
}
3939
else {
40-
wrap-content(
41-
fig,
42-
body,
43-
align: top + right,
44-
column-gutter: 1em
45-
)
40+
if (fig-align == top) {
41+
align(center, fig)
42+
body
43+
}
44+
else {
45+
wrap-content(
46+
fig,
47+
body,
48+
align: top + right,
49+
column-gutter: 1em
50+
)
51+
}
4652
}
4753
)
4854
)

0 commit comments

Comments
 (0)