-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanual.typ
87 lines (67 loc) · 2.16 KB
/
manual.typ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#import "@preview/tidy:0.2.0"
#import "/doc/example.typ": example
#import "/doc/style.typ" as doc-style
#import "/src/lib.typ" as cetz-venn
// Usage:
// ```example
// /* canvas drawing code */
// ```
#show raw.where(lang: "example"): example
#show raw.where(lang: "example-vertical"): example.with(vertical: true)
#set terms(indent: 1em)
#set par(justify: true)
#set heading(numbering: (..num) => if num.pos().len() < 4 {
numbering("1.1", ..num)
})
#show link: set text(blue)
#rect(width: 100%, fill: blue.darken(30%),
table(columns: (1fr, 1fr), align: (left, right), stroke: none,
text(white)[*CeTZ Venn*], text(white)[#cetz-venn.version]))
// Outline
#{
show heading: none
columns(2, outline(depth: 3))
pagebreak(weak: true)
}
#set page(numbering: "1/1", header: align(right)[CeTZ Venn])
= Introduction
CeTZ Venn is a tiny package for drawing two- and three-set Venn diagrams
using Typst and CeTZ.
*CeTZ version $>=$ 0.3.1 is required!*
= Examples
A simple two set Venn diagram:
```example
cetz.canvas({
cetz-venn.venn2(
name: "venn",
a-fill: gray,
ab-fill: gray,
)
import cetz.draw: *
content("venn.ab", [AB])
})
```
A three set diagram with arrows:
```example
cetz.canvas({
cetz-venn.venn3(
name: "venn",
a-fill: gray,
b-fill: gray,
abc-fill: gray,
)
import cetz.draw: *
content("venn.c", [C])
line("venn.abc", (rel: (2.2,-2.5)), mark: (start: "o", fill: black), name: "arrow")
content("arrow.end", [Here], anchor: "north", padding: .1)
})
```
= Styling
All diagrams use the style root `venn` and accept the following style keys:
#doc-style.show-parameter-block("fill", "fill", default: "white", [The default fill for all elements])
#doc-style.show-parameter-block("stroke", "stroke", default: auto, [The default stroke for all elements])
#doc-style.show-parameter-block("padding", ("number", "dictionary"), default: 2em, [
Padding of the outer (rect) element. Per side padding can be specified by passing a dicitonary with one or more
of the following keys: `top`, `bottom`, `left`, `right` and `rest`, where `rest` acts as a fallback for unset values.])
= Functions
#doc-style.parse-show-module("/src/venn.typ")