Skip to content

Commit 52d1c29

Browse files
smartart: Add process and cycle SmartArts (#117)
2 parents 2222a6b + 4885fbf commit 52d1c29

30 files changed

+1674
-23
lines changed

README.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,23 @@ CeTZ-Plot requires CeTZ version ≥ 0.3.1!
3434
<img src="gallery/pyramid.png" width="250px">
3535
</a>
3636
</td>
37+
<td colspan="2">
38+
<a href="gallery/process.typ">
39+
<img src="gallery/process.png" width="500px">
40+
</a>
41+
</td>
3742
</tr><tr>
3843
<td>Pyramid</td>
44+
<td colspan="2">Process</td>
45+
</tr>
46+
<tr>
47+
<td>
48+
<a href="gallery/circular.typ">
49+
<img src="gallery/circular.png" width="250px">
50+
</a>
51+
</td>
52+
</tr><tr>
53+
<td>Cycle</td>
3954
</tr>
4055
</table>
4156

@@ -48,7 +63,7 @@ For information, see the [manual (stable)](https://github.com/cetz-package/cetz-
4863

4964
To use this package, simply add the following code to your document:
5065
```
51-
#import "@preview/cetz:0.3.2"
66+
#import "@preview/cetz:0.3.4"
5267
#import "@preview/cetz-plot:0.1.1": plot, chart
5368
5469
#cetz.canvas({

doc/style.typ

+16-14
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,23 @@
3232

3333
set heading(level: style-args.first-heading-level + 2)
3434

35-
block(breakable: style-args.break-param-descriptions, {
36-
heading("Parameters", level: style-args.first-heading-level + 2)
37-
(style-args.style.show-parameter-list)(fn, style-args.style.show-type)
38-
})
35+
if fn.args.len() != 0 {
36+
block(breakable: style-args.break-param-descriptions, {
37+
heading("Parameters", level: style-args.first-heading-level + 2)
38+
(style-args.style.show-parameter-list)(fn, style-args.style.show-type)
39+
})
3940

40-
for (name, info) in fn.args {
41-
let types = info.at("types", default: ())
42-
let description = info.at("description", default: "")
43-
if description == [] and style-args.omit-empty-param-descriptions { continue }
44-
(style-args.style.show-parameter-block)(
45-
name, types, description,
46-
style-args,
47-
show-default: "default" in info,
48-
default: info.at("default", default: none),
49-
)
41+
for (name, info) in fn.args {
42+
let types = info.at("types", default: ())
43+
let description = info.at("description", default: "")
44+
if description == [] and style-args.omit-empty-param-descriptions { continue }
45+
(style-args.style.show-parameter-block)(
46+
name, types, description,
47+
style-args,
48+
show-default: "default" in info,
49+
default: info.at("default", default: none),
50+
)
51+
}
5052
}
5153

5254
if parameter-index != none {

gallery/barchart.png

1.37 KB
Loading

gallery/barchart.typ

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#import "@preview/cetz:0.3.2": canvas, draw
1+
#import "@preview/cetz:0.3.4": canvas, draw
22
#import "@preview/cetz-plot:0.1.1": chart
33

44
#set page(width: auto, height: auto, margin: .5cm)

gallery/bending.png

20.5 KB
Loading

gallery/bending.typ

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#import "@preview/cetz:0.3.4" as cetz: draw
2+
#import "/src/lib.typ": smartart
3+
4+
#set page(width: auto, height: auto, margin: .5cm)
5+
6+
#let steps = (
7+
[Step 1],
8+
[Step 2],
9+
[Step 3],
10+
[Step 4],
11+
[Step 5],
12+
[Step 6],
13+
)
14+
15+
#let colors = (
16+
red, orange, yellow.mix(green), green, green.mix(blue), blue
17+
).map(c => c.lighten(40%))
18+
19+
#cetz.canvas({
20+
smartart.process.bending(
21+
steps,
22+
step-style: colors,
23+
equal-width: true,
24+
name: "chart",
25+
layout: (
26+
flow: (ltr, btt),
27+
max-stride: 2
28+
)
29+
)
30+
})
31+
32+
/*
33+
#let flows = (
34+
(ltr, ttb),
35+
(ltr, btt),
36+
(rtl, ttb),
37+
(rtl, btt),
38+
(ttb, ltr),
39+
(btt, ltr),
40+
(ttb, rtl),
41+
(btt, rtl),
42+
)
43+
44+
#for flow in flows {
45+
cetz.canvas({
46+
smartart.process.bending(
47+
steps,
48+
step-style: colors,
49+
equal-width: true,
50+
name: "chart",
51+
layout: (
52+
flow: flow,
53+
max-stride: 3
54+
)
55+
)
56+
})
57+
pagebreak(weak: true)
58+
}
59+
*/

gallery/chevron.png

93.1 KB
Loading

gallery/chevron.typ

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#import "@preview/cetz:0.3.4" as cetz: draw
2+
#import "/src/lib.typ": smartart
3+
4+
#set page(width: auto, height: auto, margin: .5cm)
5+
6+
#let steps = (
7+
[Improvise],
8+
[Adapt],
9+
[Overcome]
10+
)
11+
12+
#let steps2 = (
13+
text(fill: white)[Text here],
14+
[Text here],
15+
[Text here],
16+
[Text here]
17+
).enumerate().map(((i, step)) => {
18+
grid(
19+
columns: 2,
20+
column-gutter: 0.4em,
21+
align: center + horizon,
22+
box(
23+
width: 2em,
24+
height: 2em,
25+
radius: 1em,
26+
fill: white,
27+
stroke: gray,
28+
align(center + horizon)[*0#{i + 1}*]
29+
),
30+
step
31+
)
32+
})
33+
34+
#cetz.canvas({
35+
smartart.process.chevron(
36+
steps2,
37+
step-style: (
38+
rgb("#352C6D"),
39+
rgb("#FE7275"),
40+
rgb("#8285E6"),
41+
rgb("#8CDFFD")
42+
),
43+
//equal-length: true,
44+
dir: ltr,
45+
start-cap: "(",
46+
name: "chart",
47+
steps: (max-width: 8em),
48+
start-in-cap: true,
49+
)
50+
})
51+
52+
#align(
53+
center + horizon,
54+
stack(
55+
dir: ltr,
56+
spacing: 1em,
57+
cetz.canvas({
58+
smartart.process.chevron(
59+
steps,
60+
step-style: cetz.palette.light-green,
61+
dir: rtl,
62+
start-cap: "(",
63+
end-cap: ")",
64+
spacing: 4pt
65+
)
66+
}),
67+
cetz.canvas({
68+
smartart.process.chevron(
69+
steps,
70+
step-style: cetz.palette.orange,
71+
dir: btt,
72+
start-cap: "|",
73+
end-cap: ")",
74+
spacing: 0,
75+
)
76+
}),
77+
cetz.canvas({
78+
smartart.process.chevron(
79+
steps,
80+
step-style: cetz.palette.red,
81+
dir: ttb,
82+
start-cap: "<",
83+
middle-cap: "|",
84+
end-cap: ">",
85+
spacing: 1em,
86+
)
87+
})
88+
)
89+
)

gallery/circular.png

19.6 KB
Loading

gallery/circular.typ

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#import "@preview/cetz:0.3.4" as cetz: draw
2+
#import "/src/lib.typ": smartart
3+
4+
#set page(width: auto, height: auto, margin: .5cm)
5+
6+
#let steps = (
7+
[Improvise],
8+
[Adapt],
9+
[Overcome],
10+
)
11+
12+
#let colors = (
13+
red, orange, green
14+
).map(c => c.lighten(40%))
15+
16+
#cetz.canvas({
17+
smartart.cycle.basic(
18+
steps,
19+
step-style: colors,
20+
equal-width: true,
21+
name: "chart",
22+
)
23+
})

gallery/cycles.png

95.3 KB
Loading

gallery/cycles.typ

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#import "@preview/cetz:0.3.4": canvas, draw
2+
#import "/src/lib.typ": smartart
3+
4+
#set page(width: auto, height: auto, margin: .5cm)
5+
#set text(fill: white)
6+
#let steps = ([A], [B], [C], [D], [E])
7+
8+
#let defaults() = draw.set-style(
9+
cycle-basic: (
10+
steps: (
11+
fill: rgb("#156082"),
12+
stroke: none
13+
),
14+
arrows: (
15+
fill: rgb("#156082"),
16+
stroke: rgb("#156082")
17+
)
18+
)
19+
)
20+
21+
#canvas({
22+
defaults()
23+
smartart.cycle.basic(
24+
steps,
25+
arrows: (
26+
thickness: none
27+
),
28+
step-style: none
29+
)
30+
})
31+
32+
#canvas({
33+
defaults()
34+
smartart.cycle.basic(
35+
steps.map(text.with(fill: black)),
36+
step-style: none,
37+
steps: (shape: none)
38+
)
39+
})
40+
41+
#canvas({
42+
defaults()
43+
smartart.cycle.basic(
44+
steps,
45+
step-style: none,
46+
arrows: (
47+
fill: rgb("#AAB6C1"),
48+
stroke: none
49+
)
50+
)
51+
})
52+
53+
#canvas({
54+
defaults()
55+
smartart.cycle.basic(
56+
steps,
57+
step-style: none,
58+
steps: (
59+
shape: "circle"
60+
),
61+
arrows: (
62+
fill: rgb("#AAB6C1"),
63+
stroke: none,
64+
curved: false
65+
)
66+
)
67+
})
68+
69+
#canvas({
70+
defaults()
71+
smartart.cycle.basic(
72+
steps,
73+
step-style: none,
74+
arrows: (
75+
fill: rgb("#AAB6C1"),
76+
stroke: none,
77+
curved: false,
78+
double: true
79+
)
80+
)
81+
})
82+
83+
#canvas({
84+
defaults()
85+
smartart.cycle.basic(
86+
steps,
87+
step-style: none,
88+
arrows: (
89+
fill: rgb("#AAB6C1"),
90+
stroke: none,
91+
curved: true,
92+
double: true
93+
)
94+
)
95+
})

gallery/line.png

-2.12 KB
Loading

gallery/line.typ

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#import "@preview/cetz:0.3.2": canvas, draw
1+
#import "@preview/cetz:0.3.4": canvas, draw
22
#import "@preview/cetz-plot:0.1.1": plot
33

44
#set page(width: auto, height: auto, margin: .5cm)

gallery/piechart.png

28 Bytes
Loading

gallery/piechart.typ

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#import "@preview/cetz:0.3.2"
1+
#import "@preview/cetz:0.3.4"
22
#import "@preview/cetz-plot:0.1.1": chart
33

44
#set page(width: auto, height: auto, margin: .5cm)

gallery/process.png

24.3 KB
Loading

gallery/process.typ

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#import "@preview/cetz:0.3.4" as cetz: draw
2+
#import "/src/lib.typ": smartart
3+
4+
#set page(width: auto, height: auto, margin: .5cm)
5+
6+
#let steps = (
7+
[Improvise],
8+
[Adapt],
9+
[Overcome]
10+
)
11+
12+
#let colors = (
13+
red, orange, green
14+
).map(c => c.lighten(40%))
15+
16+
#cetz.canvas({
17+
smartart.process.basic(
18+
steps,
19+
step-style: colors,
20+
equal-width: true,
21+
dir: ltr,
22+
name: "chart",
23+
)
24+
})
25+
26+
#cetz.canvas({
27+
smartart.process.chevron(
28+
steps,
29+
step-style: colors,
30+
equal-length: true,
31+
dir: ltr,
32+
name: "chart",
33+
)
34+
})

gallery/pyramid.png

1 Byte
Loading

0 commit comments

Comments
 (0)