Added tropical handout
This commit is contained in:
69
Advanced/Tropical Polynomials/macros.typ
Normal file
69
Advanced/Tropical Polynomials/macros.typ
Normal file
@ -0,0 +1,69 @@
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "handout.typ": *
|
||||
|
||||
// Shorthand, we'll be using these a lot.
|
||||
#let tp = sym.plus.circle
|
||||
#let tm = sym.times.circle
|
||||
|
||||
#let graphgrid(inner_content) = {
|
||||
align(
|
||||
center,
|
||||
box(
|
||||
inset: 3mm,
|
||||
cetz.canvas({
|
||||
import cetz.draw: *
|
||||
let x = 5.25
|
||||
|
||||
grid(
|
||||
(0, 0), (x, x), step: 0.75,
|
||||
stroke: luma(100) + 0.3mm
|
||||
)
|
||||
|
||||
if (inner_content != none) {
|
||||
inner_content
|
||||
}
|
||||
|
||||
mark((0, x + 0.5), (0, x + 1), symbol: ">", fill: black, scale: 1)
|
||||
mark((x + 0.5, 0), (x + 1, 0), symbol: ">", fill: black, scale: 1)
|
||||
|
||||
line(
|
||||
(0, x + 0.25),
|
||||
(0, 0),
|
||||
(x + 0.25, 0),
|
||||
stroke: 0.75mm + black,
|
||||
)
|
||||
}),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
/// Adds extra padding to an equation.
|
||||
/// Used as follows:
|
||||
///
|
||||
/// #eqmbox($
|
||||
/// f(x) = -2(x #tp 2)(x #tp 8)
|
||||
/// $)
|
||||
///
|
||||
/// Note that there are newlines between the $ and content,
|
||||
/// this gives us display math (which is what we want when using this macro)
|
||||
#let eqnbox(eqn) = {
|
||||
align(
|
||||
center,
|
||||
box(
|
||||
inset: 3mm,
|
||||
eqn,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
#let dotline(a, b) = {
|
||||
cetz.draw.line(
|
||||
a,
|
||||
b,
|
||||
stroke: (
|
||||
dash: "dashed",
|
||||
thickness: 0.5mm,
|
||||
paint: ored,
|
||||
),
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user