Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lacy-ubc-math-project:0.1.0 #1488

Merged
merged 7 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/preview/lacy-ubc-math-project/0.1.0/cleanup.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(ls).name
| where (str ends-with ".pdf")
| each {|el| if $el != "manual.pdf" { rm $el } }

rm template/*.pdf
64 changes: 0 additions & 64 deletions packages/preview/lacy-ubc-math-project/0.1.0/format.typ
Original file line number Diff line number Diff line change
Expand Up @@ -137,67 +137,3 @@
]
}

#let get-orientation(dir) = {
if dir == ltr {
return (
dir: ltr,
cols: (1fr, 1fr),
align: (x, y) => horizon + (right, left).at(calc.rem(x, 2)),
line: grid.vline,
)
} else if dir == ttb {
return (
dir: ttb,
cols: 1,
align: (x, y) => (bottom, top).at(calc.rem(y, 2)),
line: grid.hline,
)
}
}

#let showcode(code, dir: ltr) = {
import "@preview/showman:0.1.2": runner
let prefix-orig = (
"#import \"@preview/lacy-ubc-math-project:0.1.0\": *",
"#let __example-question-counters = range(1, unsafe.__max-qs-level + 1).map(i => counter(\"example-question-\" + str(i)))",
"#for c in __example-question-counters {",
" c.update(1)",
"}",
"#let __example-question-labels = (\"ex:1\", \"a\", \"i\",)",
"#set text(font: (\"DejaVu Serif\", \"New Computer Modern\"))",
"#let question = question.with(counters: __example-question-counters, labels: __example-question-labels)",
"#set math.equation(numbering: \"(1.1)\")",
"#show: equate.with(breakable: true, sub-numbering: true)",
).join("\n")
let suffix-orig = ""
let orientation = get-orientation(dir)
let prefix = prefix-orig
let suffix = suffix-orig
if code.lang == "typc" {
prefix = prefix + "\n#{"
suffix = "}\n" + suffix
}

runner.standalone-example(
code,
eval-prefix: prefix,
eval-suffix: suffix,
direction: orientation.dir,
container: (input, output, direction: ltr) => {
block(
// breakable: false,
width: 100%,
grid(
columns: orientation.cols,
align: orientation.align,
inset: (x: 1em, y: 0.8em),
grid.cell(input),
orientation.at("line")(stroke: 0.5pt),
grid.cell(output),
),
)
},
)
}


3 changes: 2 additions & 1 deletion packages/preview/lacy-ubc-math-project/0.1.0/lib.typ
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#import "format.typ": author, question, solution, green-solution
#import "shorthand.typ": *
#import "drawing.typ" as drawing
#import "help.typ": help

// #import "help.typ": help

#import "unsafe.typ" as unsafe

Expand Down
Binary file modified packages/preview/lacy-ubc-math-project/0.1.0/manual.pdf
Binary file not shown.
Loading
Loading