mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Change indent from 4 to 2 spaces
This commit is contained in:
parent
1ee1d078e2
commit
e35fca54a0
@ -6,20 +6,20 @@
|
||||
|
||||
// Evaluates to join of none, [My ] and the two loop bodies.
|
||||
{
|
||||
let parts = ("my fri", "end.")
|
||||
[Hello, ]
|
||||
for s in parts [{s}]
|
||||
let parts = ("my fri", "end.")
|
||||
[Hello, ]
|
||||
for s in parts [{s}]
|
||||
}
|
||||
|
||||
// Evaluates to join of the templates and strings.
|
||||
{
|
||||
[How]
|
||||
if true {
|
||||
" are"
|
||||
}
|
||||
[ ]
|
||||
if false [Nope]
|
||||
[you] + "?"
|
||||
[How]
|
||||
if true {
|
||||
" are"
|
||||
}
|
||||
[ ]
|
||||
if false [Nope]
|
||||
[you] + "?"
|
||||
}
|
||||
|
||||
---
|
||||
@ -37,24 +37,24 @@
|
||||
|
||||
// Evaluated to int.
|
||||
#test({
|
||||
let x = 1
|
||||
let y = 2
|
||||
x + y
|
||||
let x = 1
|
||||
let y = 2
|
||||
x + y
|
||||
}, 3)
|
||||
|
||||
// String is joined with trailing none, evaluates to string.
|
||||
#test({
|
||||
type("")
|
||||
none
|
||||
type("")
|
||||
none
|
||||
}, "string")
|
||||
|
||||
---
|
||||
// Some things can't be joined.
|
||||
{
|
||||
[A]
|
||||
// Error: 5-6 cannot join template with integer
|
||||
1
|
||||
[B]
|
||||
[A]
|
||||
// Error: 3-4 cannot join template with integer
|
||||
1
|
||||
[B]
|
||||
}
|
||||
|
||||
---
|
||||
@ -65,8 +65,8 @@
|
||||
---
|
||||
// Block in expression does create a scope.
|
||||
#let a = {
|
||||
let b = 1
|
||||
b
|
||||
let b = 1
|
||||
b
|
||||
}
|
||||
|
||||
#test(a, 1)
|
||||
@ -77,8 +77,8 @@
|
||||
---
|
||||
// Double block creates a scope.
|
||||
{{
|
||||
import b from "target.typ"
|
||||
test(b, 1)
|
||||
import b from "target.typ"
|
||||
test(b, 1)
|
||||
}}
|
||||
|
||||
// Error: 2-3 unknown variable
|
||||
@ -87,17 +87,17 @@
|
||||
---
|
||||
// Multiple nested scopes.
|
||||
{
|
||||
let a = "a1"
|
||||
let a = "a1"
|
||||
{
|
||||
let a = "a2"
|
||||
{
|
||||
let a = "a2"
|
||||
{
|
||||
test(a, "a2")
|
||||
let a = "a3"
|
||||
test(a, "a3")
|
||||
}
|
||||
test(a, "a2")
|
||||
test(a, "a2")
|
||||
let a = "a3"
|
||||
test(a, "a3")
|
||||
}
|
||||
test(a, "a1")
|
||||
test(a, "a2")
|
||||
}
|
||||
test(a, "a1")
|
||||
}
|
||||
|
||||
---
|
||||
@ -117,13 +117,13 @@
|
||||
|
||||
// Should output `3`.
|
||||
{
|
||||
// Error: 9-12 expected identifier, found string
|
||||
for "v"
|
||||
// Error: 7-10 expected identifier, found string
|
||||
for "v"
|
||||
|
||||
// Error: 10 expected keyword `in`
|
||||
for v let z = 1 + 2
|
||||
// Error: 8 expected keyword `in`
|
||||
for v let z = 1 + 2
|
||||
|
||||
z
|
||||
z
|
||||
}
|
||||
|
||||
---
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
// Test multiple wide calls in separate expressions inside a template.
|
||||
[
|
||||
#font!(fill: eastern) - First
|
||||
#font!(fill: forest) - Second
|
||||
#font!(fill: eastern) - First
|
||||
#font!(fill: forest) - Second
|
||||
]
|
||||
|
||||
// Test wide call in heading.
|
||||
@ -59,12 +59,12 @@ C
|
||||
|
||||
// Callee expressions.
|
||||
{
|
||||
// Wrapped in parens.
|
||||
test((type)("hi"), "string")
|
||||
// Wrapped in parens.
|
||||
test((type)("hi"), "string")
|
||||
|
||||
// Call the return value of a function.
|
||||
let adder(dx) = x => x + dx
|
||||
test(adder(2)(5), 7)
|
||||
// Call the return value of a function.
|
||||
let adder(dx) = x => x + dx
|
||||
test(adder(2)(5), 7)
|
||||
}
|
||||
|
||||
---
|
||||
|
@ -13,73 +13,73 @@
|
||||
---
|
||||
// Basic closure without captures.
|
||||
{
|
||||
let adder = (x, y) => x + y
|
||||
test(adder(2, 3), 5)
|
||||
let adder = (x, y) => x + y
|
||||
test(adder(2, 3), 5)
|
||||
}
|
||||
|
||||
---
|
||||
// Pass closure as argument and return closure.
|
||||
// Also uses shorthand syntax for a single argument.
|
||||
{
|
||||
let chain = (f, g) => (x) => f(g(x))
|
||||
let f = x => x + 1
|
||||
let g = x => 2 * x
|
||||
let h = chain(f, g)
|
||||
test(h(2), 5)
|
||||
let chain = (f, g) => (x) => f(g(x))
|
||||
let f = x => x + 1
|
||||
let g = x => 2 * x
|
||||
let h = chain(f, g)
|
||||
test(h(2), 5)
|
||||
}
|
||||
|
||||
---
|
||||
// Capture environment.
|
||||
{
|
||||
let mark = "?"
|
||||
let greet = {
|
||||
let hi = "Hi"
|
||||
name => {
|
||||
hi + ", " + name + mark
|
||||
}
|
||||
let mark = "?"
|
||||
let greet = {
|
||||
let hi = "Hi"
|
||||
name => {
|
||||
hi + ", " + name + mark
|
||||
}
|
||||
}
|
||||
|
||||
test(greet("Typst"), "Hi, Typst?")
|
||||
test(greet("Typst"), "Hi, Typst?")
|
||||
|
||||
mark = "!"
|
||||
test(greet("Typst"), "Hi, Typst!")
|
||||
mark = "!"
|
||||
test(greet("Typst"), "Hi, Typst!")
|
||||
}
|
||||
|
||||
---
|
||||
// Redefined variable.
|
||||
{
|
||||
let x = 1
|
||||
let f() = {
|
||||
let x = x + 2
|
||||
x
|
||||
}
|
||||
test(f(), 3)
|
||||
let x = 1
|
||||
let f() = {
|
||||
let x = x + 2
|
||||
x
|
||||
}
|
||||
test(f(), 3)
|
||||
}
|
||||
|
||||
---
|
||||
// Don't leak environment.
|
||||
{
|
||||
// Error: 18-19 unknown variable
|
||||
let func() = x
|
||||
let x = "hi"
|
||||
func()
|
||||
// Error: 16-17 unknown variable
|
||||
let func() = x
|
||||
let x = "hi"
|
||||
func()
|
||||
}
|
||||
|
||||
---
|
||||
// Too few arguments.
|
||||
{
|
||||
let types(x, y) = "[" + type(x) + ", " + type(y) + "]"
|
||||
test(types(14%, 12pt), "[relative, length]")
|
||||
let types(x, y) = "[" + type(x) + ", " + type(y) + "]"
|
||||
test(types(14%, 12pt), "[relative, length]")
|
||||
|
||||
// Error: 16-22 missing argument: y
|
||||
test(types("nope"), "[string, none]")
|
||||
// Error: 14-20 missing argument: y
|
||||
test(types("nope"), "[string, none]")
|
||||
}
|
||||
|
||||
---
|
||||
// Too many arguments.
|
||||
{
|
||||
let f(x) = x + 1
|
||||
let f(x) = x + 1
|
||||
|
||||
// Error: 10-15 unexpected argument
|
||||
f(1, "two", () => x)
|
||||
// Error: 8-13 unexpected argument
|
||||
f(1, "two", () => x)
|
||||
}
|
||||
|
@ -10,22 +10,22 @@
|
||||
// Dictionary is not traversed in insertion order.
|
||||
// Should output `Age: 2. Name: Typst.`.
|
||||
#for k, v in (Name: "Typst", Age: 2) [
|
||||
{k}: {v}.
|
||||
{k}: {v}.
|
||||
]
|
||||
|
||||
// Block body.
|
||||
// Should output `[1st, 2nd, 3rd, 4th, 5th]`.
|
||||
{
|
||||
"["
|
||||
for v in (1, 2, 3, 4, 5) {
|
||||
if v > 1 [, ]
|
||||
[#v]
|
||||
if v == 1 [st]
|
||||
if v == 2 [nd]
|
||||
if v == 3 [rd]
|
||||
if v >= 4 [th]
|
||||
}
|
||||
"]"
|
||||
"["
|
||||
for v in (1, 2, 3, 4, 5) {
|
||||
if v > 1 [, ]
|
||||
[#v]
|
||||
if v == 1 [st]
|
||||
if v == 2 [nd]
|
||||
if v == 3 [rd]
|
||||
if v >= 4 [th]
|
||||
}
|
||||
"]"
|
||||
}
|
||||
|
||||
// Template body.
|
||||
@ -37,23 +37,23 @@
|
||||
|
||||
// Values of array.
|
||||
#for v in (1, 2, 3) {
|
||||
out += (v,)
|
||||
out += (v,)
|
||||
}
|
||||
|
||||
// Indices and values of array.
|
||||
#for i, v in ("1", "2", "3") {
|
||||
test(repr(i + 1), v)
|
||||
test(repr(i + 1), v)
|
||||
}
|
||||
|
||||
// Values of dictionary.
|
||||
#for v in (a: 4, b: 5) {
|
||||
out += (v,)
|
||||
out += (v,)
|
||||
}
|
||||
|
||||
// Keys and values of dictionary.
|
||||
#for k, v in (a: 6, b: 7) {
|
||||
out += (k,)
|
||||
out += (v,)
|
||||
out += (k,)
|
||||
out += (v,)
|
||||
}
|
||||
|
||||
#test(out, (1, 2, 3, 4, 5, "a", 6, "b", 7))
|
||||
@ -61,9 +61,9 @@
|
||||
// Chars of string.
|
||||
#let first = true
|
||||
#let joined = for c in "abc" {
|
||||
if not first { ", " }
|
||||
first = false
|
||||
c
|
||||
if not first { ", " }
|
||||
first = false
|
||||
c
|
||||
}
|
||||
|
||||
#test(joined, "a, b, c")
|
||||
@ -81,7 +81,7 @@
|
||||
// Keys and values of strings.
|
||||
// Error: 6-10 mismatched pattern
|
||||
#for k, v in "hi" {
|
||||
dont-care
|
||||
dont-care
|
||||
}
|
||||
|
||||
---
|
||||
|
@ -3,46 +3,46 @@
|
||||
---
|
||||
// Test condition evaluation.
|
||||
#if 1 < 2 [
|
||||
One.
|
||||
One.
|
||||
]
|
||||
|
||||
#if true == false [
|
||||
{Bad}, but we {dont-care}!
|
||||
{Bad}, but we {dont-care}!
|
||||
]
|
||||
|
||||
---
|
||||
// Braced condition.
|
||||
#if {true} [
|
||||
One.
|
||||
One.
|
||||
]
|
||||
|
||||
// Template in condition.
|
||||
#if [] != none [
|
||||
Two.
|
||||
Two.
|
||||
]
|
||||
|
||||
// Multi-line condition with parens.
|
||||
#if (
|
||||
1 + 1
|
||||
== 1
|
||||
1 + 1
|
||||
== 1
|
||||
) [
|
||||
Nope.
|
||||
Nope.
|
||||
] #else {
|
||||
"Three."
|
||||
"Three."
|
||||
}
|
||||
|
||||
// Multiline.
|
||||
#if false [
|
||||
Bad.
|
||||
Bad.
|
||||
] #else {
|
||||
let point = "."
|
||||
"Four" + point
|
||||
let point = "."
|
||||
"Four" + point
|
||||
}
|
||||
|
||||
// Template can be argument or body depending on whitespace.
|
||||
{
|
||||
if "template" == type[b] [Fi] else [Nope]
|
||||
if "template" == type [Nope] else [ve.]
|
||||
if "template" == type[b] [Fi] else [Nope]
|
||||
if "template" == type [Nope] else [ve.]
|
||||
}
|
||||
|
||||
---
|
||||
@ -50,21 +50,21 @@
|
||||
// Ref: false
|
||||
|
||||
{
|
||||
let x = 1
|
||||
let y = 2
|
||||
let z
|
||||
let x = 1
|
||||
let y = 2
|
||||
let z
|
||||
|
||||
// Returns if branch.
|
||||
z = if x < y { "ok" }
|
||||
test(z, "ok")
|
||||
// Returns if branch.
|
||||
z = if x < y { "ok" }
|
||||
test(z, "ok")
|
||||
|
||||
// Returns else branch.
|
||||
z = if x > y { "bad" } else { "ok" }
|
||||
test(z, "ok")
|
||||
// Returns else branch.
|
||||
z = if x > y { "bad" } else { "ok" }
|
||||
test(z, "ok")
|
||||
|
||||
// Missing else evaluates to none.
|
||||
z = if x > y { "bad" }
|
||||
test(z, none)
|
||||
// Missing else evaluates to none.
|
||||
z = if x > y { "bad" }
|
||||
test(z, none)
|
||||
}
|
||||
|
||||
---
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
// Code mode
|
||||
{
|
||||
import b from "target.typ"
|
||||
test(b, 1)
|
||||
import b from "target.typ"
|
||||
test(b, 1)
|
||||
}
|
||||
|
||||
#test(b, 1)
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
---
|
||||
{
|
||||
// Error: 21-43 file not found
|
||||
let x = include "importable/chap3.typ"
|
||||
// Error: 19-41 file not found
|
||||
let x = include "importable/chap3.typ"
|
||||
}
|
||||
|
||||
---
|
||||
|
@ -10,9 +10,9 @@
|
||||
---
|
||||
// Assignment is right-associative.
|
||||
{
|
||||
let x = 1
|
||||
let y = 2
|
||||
x = y = "ok"
|
||||
test(x, none)
|
||||
test(y, "ok")
|
||||
let x = 1
|
||||
let y = 2
|
||||
x = y = "ok"
|
||||
test(x, none)
|
||||
test(y, "ok")
|
||||
}
|
||||
|
@ -11,15 +11,15 @@
|
||||
|
||||
// Test plus and minus.
|
||||
#for v in (1, 3.14, 12pt, 45deg, 90%, 13% + 10pt, 6.3fr) {
|
||||
// Test plus.
|
||||
test(+v, v)
|
||||
// Test plus.
|
||||
test(+v, v)
|
||||
|
||||
// Test minus.
|
||||
test(-v, -1 * v)
|
||||
test(--v, v)
|
||||
// Test minus.
|
||||
test(-v, -1 * v)
|
||||
test(--v, v)
|
||||
|
||||
// Test combination.
|
||||
test(-++ --v, -v)
|
||||
// Test combination.
|
||||
test(-++ --v, -v)
|
||||
}
|
||||
|
||||
#test(-(4 + 2), 6-12)
|
||||
@ -50,24 +50,24 @@
|
||||
// Mathematical identities.
|
||||
#let nums = (1, 3.14, 12pt, 45deg, 90%, 13% + 10pt)
|
||||
#for v in nums {
|
||||
// Test plus and minus.
|
||||
test(v + v - v, v)
|
||||
test(v - v - v, -v)
|
||||
// Test plus and minus.
|
||||
test(v + v - v, v)
|
||||
test(v - v - v, -v)
|
||||
|
||||
// Test plus/minus and multiplication.
|
||||
test(v - v, 0 * v)
|
||||
test(v + v, 2 * v)
|
||||
// Test plus/minus and multiplication.
|
||||
test(v - v, 0 * v)
|
||||
test(v + v, 2 * v)
|
||||
|
||||
// Integer addition does not give a float.
|
||||
if type(v) != "integer" {
|
||||
test(v + v, 2.0 * v)
|
||||
}
|
||||
// Integer addition does not give a float.
|
||||
if type(v) != "integer" {
|
||||
test(v + v, 2.0 * v)
|
||||
}
|
||||
|
||||
// Linears cannot be divided by themselves.
|
||||
if type(v) != "linear" {
|
||||
test(v / v, 1.0)
|
||||
test(v / v == 1, true)
|
||||
}
|
||||
// Linears cannot be divided by themselves.
|
||||
if type(v) != "linear" {
|
||||
test(v / v, 1.0)
|
||||
test(v / v == 1, true)
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure length, relative and linear
|
||||
@ -76,15 +76,15 @@
|
||||
// - divided by floats.
|
||||
#let dims = (10pt, 30%, 50% + 3cm)
|
||||
#for a in dims {
|
||||
for b in dims {
|
||||
test(type(a + b), type(a - b))
|
||||
}
|
||||
for b in dims {
|
||||
test(type(a + b), type(a - b))
|
||||
}
|
||||
|
||||
for b in (7, 3.14) {
|
||||
test(type(a * b), type(a))
|
||||
test(type(b * a), type(a))
|
||||
test(type(a / b), type(a))
|
||||
}
|
||||
for b in (7, 3.14) {
|
||||
test(type(a * b), type(a))
|
||||
test(type(b * a), type(a))
|
||||
test(type(a / b), type(a))
|
||||
}
|
||||
}
|
||||
|
||||
---
|
||||
|
@ -4,19 +4,19 @@
|
||||
// Should output `2 4 6 8 10`.
|
||||
#let i = 0
|
||||
#while i < 10 [
|
||||
{ i += 2 }
|
||||
#i
|
||||
{ i += 2 }
|
||||
#i
|
||||
]
|
||||
|
||||
// Should output `Hi`.
|
||||
#let iter = true
|
||||
#while iter {
|
||||
iter = false
|
||||
"Hi."
|
||||
iter = false
|
||||
"Hi."
|
||||
}
|
||||
|
||||
#while false {
|
||||
dont-care
|
||||
dont-care
|
||||
}
|
||||
|
||||
---
|
||||
@ -36,8 +36,8 @@
|
||||
---
|
||||
// Make sure that we terminate and don't complain multiple times.
|
||||
#while true {
|
||||
// Error: 5-9 unknown variable
|
||||
nope
|
||||
// Error: 3-7 unknown variable
|
||||
nope
|
||||
}
|
||||
|
||||
---
|
||||
|
@ -14,12 +14,12 @@
|
||||
// the only argument to a function is a template, the parentheses can be omitted
|
||||
// (i.e. `f[a]` is the same as `f([a])`).
|
||||
#box[
|
||||
// Backslash adds a forced line break.
|
||||
#university \
|
||||
#faculty \
|
||||
Sekretariat MA \
|
||||
Dr. Max Mustermann \
|
||||
Ola Nordmann, John Doe
|
||||
// Backslash adds a forced line break.
|
||||
#university \
|
||||
#faculty \
|
||||
Sekretariat MA \
|
||||
Dr. Max Mustermann \
|
||||
Ola Nordmann, John Doe
|
||||
]
|
||||
#align(right, box[*WiSe 2019/2020* \ Woche 3])
|
||||
|
||||
@ -29,10 +29,10 @@
|
||||
// If the last argument to a function is a template, we can also place it behind
|
||||
// the parentheses.
|
||||
#align(center)[
|
||||
// Markdown-like syntax for headings.
|
||||
==== 3. Übungsblatt Computerorientierte Mathematik II #v(4mm)
|
||||
*Abgabe: 03.05.2019* (bis 10:10 Uhr in MA 001) #v(4mm)
|
||||
*Alle Antworten sind zu beweisen.*
|
||||
// Markdown-like syntax for headings.
|
||||
==== 3. Übungsblatt Computerorientierte Mathematik II #v(4mm)
|
||||
*Abgabe: 03.05.2019* (bis 10:10 Uhr in MA 001) #v(4mm)
|
||||
*Alle Antworten sind zu beweisen.*
|
||||
]
|
||||
|
||||
*1. Aufgabe* #align(right)[(1 + 1 + 2 Punkte)]
|
||||
|
@ -5,22 +5,22 @@
|
||||
|
||||
Auto-sized circle. \
|
||||
#circle(fill: rgb("eb5278"))[
|
||||
#align!(center, center)
|
||||
But, soft!
|
||||
#align!(center, center)
|
||||
But, soft!
|
||||
]
|
||||
|
||||
Center-aligned rect in auto-sized circle.
|
||||
#circle(fill: forest)[
|
||||
#align!(center, center)
|
||||
#rect!(fill: conifer)
|
||||
#pad!(5pt)
|
||||
But, soft!
|
||||
#align!(center, center)
|
||||
#rect!(fill: conifer)
|
||||
#pad!(5pt)
|
||||
But, soft!
|
||||
]
|
||||
|
||||
100%-width rect in auto-sized circle. \
|
||||
#circle(fill: forest)[
|
||||
#rect!(width: 100%, fill: conifer)
|
||||
But, soft! what light through yonder window breaks?
|
||||
#rect!(width: 100%, fill: conifer)
|
||||
But, soft! what light through yonder window breaks?
|
||||
]
|
||||
|
||||
Expanded by height.
|
||||
@ -29,11 +29,11 @@ Expanded by height.
|
||||
---
|
||||
// Test relative sizing.
|
||||
#rect(width: 100%, height: 50pt, fill: rgb("aaa"))[
|
||||
#align!(center, center)
|
||||
#font!(fill: white)
|
||||
#circle(radius: 10pt, fill: eastern)[A]
|
||||
#circle(height: 60%, fill: eastern)[B]
|
||||
#circle(width: 20% + 20pt, fill: eastern)[C]
|
||||
#align!(center, center)
|
||||
#font!(fill: white)
|
||||
#circle(radius: 10pt, fill: eastern)[A]
|
||||
#circle(height: 60%, fill: eastern)[B]
|
||||
#circle(width: 20% + 20pt, fill: eastern)[C]
|
||||
]
|
||||
|
||||
---
|
||||
|
@ -3,13 +3,13 @@
|
||||
---
|
||||
100% rect in 100% ellipse in fixed rect. \
|
||||
#rect(width: 3cm, height: 2cm, fill: rgb("2a631a"))[
|
||||
#ellipse!(width: 100%, height: 100%, fill: forest)
|
||||
#rect!(width: 100%, height: 100%, fill: conifer)
|
||||
#align!(center, center)
|
||||
Stuff inside an ellipse!
|
||||
#ellipse!(width: 100%, height: 100%, fill: forest)
|
||||
#rect!(width: 100%, height: 100%, fill: conifer)
|
||||
#align!(center, center)
|
||||
Stuff inside an ellipse!
|
||||
]
|
||||
|
||||
Auto-sized ellipse. \
|
||||
#ellipse(fill: conifer)[
|
||||
But, soft! what light through yonder window breaks?
|
||||
But, soft! what light through yonder window breaks?
|
||||
]
|
||||
|
@ -3,24 +3,24 @@
|
||||
---
|
||||
Auto-sized square. \
|
||||
#square(fill: eastern)[
|
||||
#align!(center)
|
||||
#pad!(5pt)
|
||||
#font!(fill: white, weight: bold)
|
||||
Typst
|
||||
#align!(center)
|
||||
#pad!(5pt)
|
||||
#font!(fill: white, weight: bold)
|
||||
Typst
|
||||
]
|
||||
|
||||
---
|
||||
// Test height overflow.
|
||||
#page!(width: 75pt, height: 100pt)
|
||||
#square(fill: conifer)[
|
||||
But, soft! what light through yonder window breaks?
|
||||
But, soft! what light through yonder window breaks?
|
||||
]
|
||||
|
||||
---
|
||||
// Test width overflow.
|
||||
#page!(width: 100pt, height: 75pt)
|
||||
#square(fill: conifer)[
|
||||
But, soft! what light through yonder window breaks?
|
||||
But, soft! what light through yonder window breaks?
|
||||
]
|
||||
|
||||
---
|
||||
|
@ -5,52 +5,52 @@
|
||||
|
||||
#page!(width: 100pt, height: 140pt)
|
||||
#grid(
|
||||
columns: (auto, 1fr, 3fr, 0.25cm, 3%, 2mm + 10%),
|
||||
rect(0.5cm, rgb("2a631a")),
|
||||
rect(100%, forest),
|
||||
rect(100%, conifer),
|
||||
rect(100%, rgb("ff0000")),
|
||||
rect(100%, rgb("00ff00")),
|
||||
rect(80%, rgb("00faf0")),
|
||||
rect(1cm, rgb("00ff00")),
|
||||
rect(0.5cm, rgb("2a631a")),
|
||||
rect(100%, forest),
|
||||
rect(100%, conifer),
|
||||
rect(100%, rgb("ff0000")),
|
||||
rect(100%, rgb("00ff00")),
|
||||
columns: (auto, 1fr, 3fr, 0.25cm, 3%, 2mm + 10%),
|
||||
rect(0.5cm, rgb("2a631a")),
|
||||
rect(100%, forest),
|
||||
rect(100%, conifer),
|
||||
rect(100%, rgb("ff0000")),
|
||||
rect(100%, rgb("00ff00")),
|
||||
rect(80%, rgb("00faf0")),
|
||||
rect(1cm, rgb("00ff00")),
|
||||
rect(0.5cm, rgb("2a631a")),
|
||||
rect(100%, forest),
|
||||
rect(100%, conifer),
|
||||
rect(100%, rgb("ff0000")),
|
||||
rect(100%, rgb("00ff00")),
|
||||
)
|
||||
|
||||
#grid()
|
||||
|
||||
---
|
||||
#grid(
|
||||
columns: (auto, auto, 40%),
|
||||
gutter-columns: (1fr,),
|
||||
gutter-rows: (1fr,),
|
||||
rect(fill: eastern)[dddaa aaa aaa],
|
||||
rect(fill: conifer)[ccc],
|
||||
rect(width: 100%, fill: rgb("dddddd"))[aaa],
|
||||
columns: (auto, auto, 40%),
|
||||
gutter-columns: (1fr,),
|
||||
gutter-rows: (1fr,),
|
||||
rect(fill: eastern)[dddaa aaa aaa],
|
||||
rect(fill: conifer)[ccc],
|
||||
rect(width: 100%, fill: rgb("dddddd"))[aaa],
|
||||
)
|
||||
|
||||
---
|
||||
#page!(height: 3cm, width: 2cm)
|
||||
#grid(
|
||||
columns: (1fr, 1cm, 1fr, 1fr),
|
||||
column-dir: ttb,
|
||||
rows: (auto, 1fr),
|
||||
rect(height: 100%, fill: rgb("222222"))[foo],
|
||||
rect(height: 100%, fill: rgb("547d0a"))[bar],
|
||||
rect(height: 100%, fill: eastern)[hab],
|
||||
rect(height: 100%, fill: conifer)[baz],
|
||||
rect(height: 100%, width: 100%, fill: rgb("547d0a"))[bar],
|
||||
columns: (1fr, 1cm, 1fr, 1fr),
|
||||
column-dir: ttb,
|
||||
rows: (auto, 1fr),
|
||||
rect(height: 100%, fill: rgb("222222"))[foo],
|
||||
rect(height: 100%, fill: rgb("547d0a"))[bar],
|
||||
rect(height: 100%, fill: eastern)[hab],
|
||||
rect(height: 100%, fill: conifer)[baz],
|
||||
rect(height: 100%, width: 100%, fill: rgb("547d0a"))[bar],
|
||||
)
|
||||
|
||||
---
|
||||
#page!(height: 3cm, margins: 0pt)
|
||||
#align!(center)
|
||||
#grid(
|
||||
columns: (1fr,),
|
||||
rows: (1fr, auto, 2fr),
|
||||
[], rect(width: 100%)[A bit more to the top], [],
|
||||
columns: (1fr,),
|
||||
rows: (1fr, auto, 2fr),
|
||||
[], rect(width: 100%)[A bit more to the top], [],
|
||||
)
|
||||
|
||||
|
@ -3,27 +3,27 @@
|
||||
---
|
||||
#page!(width: 12cm, height: 2.5cm)
|
||||
#grid(
|
||||
columns: 5,
|
||||
gutter-columns: (2fr, 1fr, 1fr),
|
||||
gutter-rows: 4 * (6pt,),
|
||||
[*Quarter*],
|
||||
[Expenditure],
|
||||
[External Revenue],
|
||||
[Financial ROI],
|
||||
[_total_],
|
||||
[*Q1*],
|
||||
[173,472.57 \$],
|
||||
[472,860.91 \$],
|
||||
[51,286.84 \$],
|
||||
[_350,675.18 \$_],
|
||||
[*Q2*],
|
||||
[93,382.12 \$],
|
||||
[439,382.85 \$],
|
||||
[-1,134.30 \$],
|
||||
[_344,866.43 \$_],
|
||||
[*Q3*],
|
||||
[96,421.49 \$],
|
||||
[238,583.54 \$],
|
||||
[3,497.12 \$],
|
||||
[_145,659.17 \$_],
|
||||
columns: 5,
|
||||
gutter-columns: (2fr, 1fr, 1fr),
|
||||
gutter-rows: 4 * (6pt,),
|
||||
[*Quarter*],
|
||||
[Expenditure],
|
||||
[External Revenue],
|
||||
[Financial ROI],
|
||||
[_total_],
|
||||
[*Q1*],
|
||||
[173,472.57 \$],
|
||||
[472,860.91 \$],
|
||||
[51,286.84 \$],
|
||||
[_350,675.18 \$_],
|
||||
[*Q2*],
|
||||
[93,382.12 \$],
|
||||
[439,382.85 \$],
|
||||
[-1,134.30 \$],
|
||||
[_344,866.43 \$_],
|
||||
[*Q3*],
|
||||
[96,421.49 \$],
|
||||
[238,583.54 \$],
|
||||
[3,497.12 \$],
|
||||
[_145,659.17 \$_],
|
||||
)
|
||||
|
@ -3,16 +3,16 @@
|
||||
---
|
||||
#page!(width: 5cm, height: 3cm)
|
||||
#grid(
|
||||
columns: 2,
|
||||
gutter-rows: 3 * (8pt,),
|
||||
[Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
|
||||
columns: 2,
|
||||
gutter-rows: 3 * (8pt,),
|
||||
[Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
|
||||
|
||||
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis.],
|
||||
[Text that is rather short],
|
||||
[Fireflies],
|
||||
[Critical],
|
||||
[Decorum],
|
||||
[Rampage],
|
||||
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis.],
|
||||
[Text that is rather short],
|
||||
[Fireflies],
|
||||
[Critical],
|
||||
[Decorum],
|
||||
[Rampage],
|
||||
)
|
||||
|
||||
---
|
||||
@ -20,60 +20,60 @@
|
||||
// that.
|
||||
#page!(width: 5cm, height: 2cm)
|
||||
#grid(
|
||||
columns: 4 * (1fr,),
|
||||
gutter-rows: (10pt,),
|
||||
gutter-columns: (0pt, 10%),
|
||||
image("../../res/rhino.png"),
|
||||
align(right, rect(width: 100%, fill: eastern)[LoL]),
|
||||
[rofl],
|
||||
[\ A] * 3,
|
||||
[Ha!\ ] * 3,
|
||||
columns: 4 * (1fr,),
|
||||
gutter-rows: (10pt,),
|
||||
gutter-columns: (0pt, 10%),
|
||||
image("../../res/rhino.png"),
|
||||
align(right, rect(width: 100%, fill: eastern)[LoL]),
|
||||
[rofl],
|
||||
[\ A] * 3,
|
||||
[Ha!\ ] * 3,
|
||||
)
|
||||
|
||||
---
|
||||
// Test two columns in the same row overflowing by a different amount.
|
||||
#page!(width: 5cm, height: 2cm)
|
||||
#grid(
|
||||
columns: 3 * (1fr,),
|
||||
gutter-rows: (8pt,),
|
||||
gutter-columns: (0pt, 10%),
|
||||
[A], [B], [C],
|
||||
[Ha!\ ] * 6,
|
||||
[rofl],
|
||||
[\ A] * 3,
|
||||
[hello],
|
||||
[darkness],
|
||||
[my old]
|
||||
columns: 3 * (1fr,),
|
||||
gutter-rows: (8pt,),
|
||||
gutter-columns: (0pt, 10%),
|
||||
[A], [B], [C],
|
||||
[Ha!\ ] * 6,
|
||||
[rofl],
|
||||
[\ A] * 3,
|
||||
[hello],
|
||||
[darkness],
|
||||
[my old]
|
||||
)
|
||||
|
||||
---
|
||||
// Test grid within a grid, overflowing.
|
||||
#page!(width: 5cm, height: 2.25cm)
|
||||
#grid(
|
||||
columns: 4 * (1fr,),
|
||||
gutter-rows: (10pt,),
|
||||
gutter-columns: (0pt, 10%),
|
||||
[A], [B], [C], [D],
|
||||
grid(columns: 2, [A], [B], [C\ ]*3, [D]),
|
||||
align(right, rect(width: 100%, fill: eastern)[LoL]),
|
||||
[rofl],
|
||||
[E\ ]*4,
|
||||
columns: 4 * (1fr,),
|
||||
gutter-rows: (10pt,),
|
||||
gutter-columns: (0pt, 10%),
|
||||
[A], [B], [C], [D],
|
||||
grid(columns: 2, [A], [B], [C\ ]*3, [D]),
|
||||
align(right, rect(width: 100%, fill: eastern)[LoL]),
|
||||
[rofl],
|
||||
[E\ ]*4,
|
||||
)
|
||||
|
||||
---
|
||||
// Test partition of `fr` units before and after multi-region layout.
|
||||
#page!(width: 5cm, height: 4cm)
|
||||
#grid(
|
||||
columns: 2 * (1fr,),
|
||||
rows: (1fr, 2fr, auto, 1fr, 1cm),
|
||||
gutter-rows: 4 * (10pt,),
|
||||
rect(height: 100%, width: 100%, fill: rgb("ff0000"))[No height],
|
||||
[foo],
|
||||
rect(height: 100%, width: 100%, fill: rgb("fc0030"))[Still no height],
|
||||
[bar],
|
||||
[The nature of being itself is in question. Am I One? Am I Many? What is being alive?],
|
||||
[baz],
|
||||
[The answer],
|
||||
[42],
|
||||
[Other text of interest],
|
||||
columns: 2 * (1fr,),
|
||||
rows: (1fr, 2fr, auto, 1fr, 1cm),
|
||||
gutter-rows: 4 * (10pt,),
|
||||
rect(height: 100%, width: 100%, fill: rgb("ff0000"))[No height],
|
||||
[foo],
|
||||
rect(height: 100%, width: 100%, fill: rgb("fc0030"))[Still no height],
|
||||
[bar],
|
||||
[The nature of being itself is in question. Am I One? Am I Many? What is being alive?],
|
||||
[baz],
|
||||
[The answer],
|
||||
[42],
|
||||
[Other text of interest],
|
||||
)
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
// Set all margins at once.
|
||||
#page(margins: 30pt)[
|
||||
#align(top, left)[TL]
|
||||
#align(bottom, right)[BR]
|
||||
#align(top, left)[TL]
|
||||
#align(bottom, right)[BR]
|
||||
]
|
||||
|
||||
// Set individual margins.
|
||||
|
@ -9,9 +9,9 @@ First of two
|
||||
// Make sure that you can't do page related stuff in a container.
|
||||
A
|
||||
#box[
|
||||
B
|
||||
#pagebreak()
|
||||
#page("a4")[]
|
||||
B
|
||||
#pagebreak()
|
||||
#page("a4")[]
|
||||
]
|
||||
C
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
---
|
||||
#let rect(width, fill) = rect(width: width, height: 1cm, fill: fill)
|
||||
#stack(
|
||||
rect(2cm, rgb("2a631a")),
|
||||
rect(3cm, forest),
|
||||
rect(1cm, conifer),
|
||||
rect(2cm, rgb("2a631a")),
|
||||
rect(3cm, forest),
|
||||
rect(1cm, conifer),
|
||||
)
|
||||
|
||||
---
|
||||
@ -13,6 +13,6 @@
|
||||
|
||||
#let rect(width, fill) = rect(width: 1cm, height: 0.4cm, fill: fill)
|
||||
#box(height: 0.5cm, stack(
|
||||
rect(3cm, forest),
|
||||
rect(1cm, conifer),
|
||||
rect(3cm, forest),
|
||||
rect(1cm, conifer),
|
||||
))
|
||||
|
@ -37,5 +37,5 @@ No = heading
|
||||
|
||||
// Code blocks continue heading.
|
||||
= A {
|
||||
"B"
|
||||
"B"
|
||||
}
|
||||
|
@ -3,16 +3,16 @@
|
||||
---
|
||||
// Test that alignment depends on the paragraph's full width.
|
||||
#box[
|
||||
Hello World \
|
||||
#align(right)[World]
|
||||
Hello World \
|
||||
#align(right)[World]
|
||||
]
|
||||
|
||||
---
|
||||
// Test that a line with multiple alignments respects the paragraph's full
|
||||
// width.
|
||||
#box[
|
||||
Hello #align(center)[World] \
|
||||
Hello from the World
|
||||
Hello #align(center)[World] \
|
||||
Hello from the World
|
||||
]
|
||||
|
||||
---
|
||||
|
@ -26,7 +26,7 @@ Emoji: 🐪, 🌋, 🏞
|
||||
|
||||
// Math.
|
||||
#font("Latin Modern Math")[
|
||||
∫ 𝛼 + 3𝛽 d𝑡
|
||||
∫ 𝛼 + 3𝛽 d𝑡
|
||||
]
|
||||
|
||||
// Colors.
|
||||
@ -37,8 +37,8 @@ Emoji: 🐪, 🌋, 🏞
|
||||
|
||||
#page!(width: 170pt)
|
||||
#let try(top, bottom) = rect(fill: conifer)[
|
||||
#font!(top-edge: top, bottom-edge: bottom)
|
||||
`From `#top` to `#bottom
|
||||
#font!(top-edge: top, bottom-edge: bottom)
|
||||
`From `#top` to `#bottom
|
||||
]
|
||||
|
||||
#try(ascender, descender)
|
||||
|
Loading…
x
Reference in New Issue
Block a user