From df28a09214336b3243e275b003773c318ff70458 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 21 Jan 2025 20:33:42 -0800 Subject: [PATCH] Added typstyle action --- .github/workflows/lints.yml | 15 ++++++++++ .vscode/settings.json | 3 +- lib/typst/handout.typ | 11 +++++-- .../parts/01 polynomials.typ | 30 ++++++++++++++++--- 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml index 3b96eb9..6e35c58 100644 --- a/.github/workflows/lints.yml +++ b/.github/workflows/lints.yml @@ -13,3 +13,18 @@ jobs: uses: crate-ci/typos@master with: config: ./tools/typos.toml + + typstyle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: "Download Typstyle" + run: | + wget -q "https://github.com/Enter-tainer/typstyle/releases/download/v0.12.14/typstyle-x86_64-unknown-linux-musl" + chmod +x typstyle-x86_64-unknown-linux-musl + + - name: Check typst formatting + run: | + find . -name "*.typ" -type f -print0 | xargs -0 \ + ./typstyle-x86_64-unknown-linux-musl --check diff --git a/.vscode/settings.json b/.vscode/settings.json index af71884..75ed45d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "latex-workshop.latex.recipe.default": "latexmk (xelatex)" + "latex-workshop.latex.recipe.default": "latexmk (xelatex)", + "tinymist.formatterPrintWidth": 80 } diff --git a/lib/typst/handout.typ b/lib/typst/handout.typ index 4be58db..90313ca 100755 --- a/lib/typst/handout.typ +++ b/lib/typst/handout.typ @@ -9,7 +9,9 @@ #let show_solutions = { if "show_solutions" in sys.inputs { // Show solutions unless they're explicitly disabled - not (sys.inputs.show_solutions == "false" or sys.inputs.show_solutions == "no") + not ( + sys.inputs.show_solutions == "false" or sys.inputs.show_solutions == "no" + ) } else { // Show solutions by default true @@ -91,7 +93,12 @@ #let preparedby(name) = ( text( size: 10pt, - [Prepared by ] + name + [ on ] + datetime.today().display("[month repr:long] [day padding:none], [year]"), + [Prepared by ] + + name + + [ on ] + + datetime + .today() + .display("[month repr:long] [day padding:none], [year]"), ) ) diff --git a/src/Advanced/Tropical Polynomials/parts/01 polynomials.typ b/src/Advanced/Tropical Polynomials/parts/01 polynomials.typ index fe980de..08ebc0c 100644 --- a/src/Advanced/Tropical Polynomials/parts/01 polynomials.typ +++ b/src/Advanced/Tropical Polynomials/parts/01 polynomials.typ @@ -76,7 +76,13 @@ Draw a graph of the tropical polynomial $f(x) = x^2 #tp 1x #tp 4$. \ dotline((0, 1 * step), (7 * step, 8 * step)) dotline((0, 4 * step), (8 * step, 4 * step)) - line((0, 0), (1 * step, 2 * step), (3 * step, 4 * step), (7.5 * step, 4 * step), stroke: 1mm + oblue) + line( + (0, 0), + (1 * step, 2 * step), + (3 * step, 4 * step), + (7.5 * step, 4 * step), + stroke: 1mm + oblue, + ) }) ]) @@ -138,7 +144,13 @@ Graph $f(x) = -2x^2 #tp x #tp 8$. \ dotline((0.5 * step, 0), (4 * step, 8 * step)) dotline((0, 4 * step), (8 * step, 4 * step)) - line((0.5 * step, 0), (1 * step, 1 * step), (4 * step, 4 * step), (7.5 * step, 4 * step), stroke: 1mm + oblue) + line( + (0.5 * step, 0), + (1 * step, 1 * step), + (4 * step, 4 * step), + (7.5 * step, 4 * step), + stroke: 1mm + oblue, + ) }) ]) @@ -212,7 +224,12 @@ Graph $f(x) = 1x^2 #tp 3x #tp 5$. dotline((0, 5 * step), (8 * step, 5 * step)) dotline((0, 3 * step), (5 * step, 8 * step)) - line((0, 1 * step), (2 * step, 5 * step), (7.5 * step, 5 * step), stroke: 1mm + oblue) + line( + (0, 1 * step), + (2 * step, 5 * step), + (7.5 * step, 5 * step), + stroke: 1mm + oblue, + ) }) ]) @@ -256,7 +273,12 @@ Graph $f(x) = 2x^2 #tp 4x #tp 4$. dotline((0, 4 * step), (5 * step, 8 * step)) dotline((0, 4 * step), (8 * step, 4 * step)) - line((0, 2 * step), (1 * step, 4 * step), (7.5 * step, 4 * step), stroke: 1mm + oblue) + line( + (0, 2 * step), + (1 * step, 4 * step), + (7.5 * step, 4 * step), + stroke: 1mm + oblue, + ) }), )