Skip to content

Instantly share code, notes, and snippets.

@tapyu
Last active August 3, 2024 05:01
Show Gist options
  • Select an option

  • Save tapyu/7c961e9a891bd9087ce93c6949519b67 to your computer and use it in GitHub Desktop.

Select an option

Save tapyu/7c961e9a891bd9087ce93c6949519b67 to your computer and use it in GitHub Desktop.

Revisions

  1. tapyu revised this gist Aug 3, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion _preamble.typ
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // *** packages ***
    #import "@preview/unify:0.6.0": num,qty,numrange,qtyrange
    #import "@preview/pinit:0.1.4": * // pin things as you like
    #import "@preview/diverential:0.2.0": * // typesetting of differentials
    #import "@preview/physica:0.9.3": * // physics-like package

    // *** operations ***

  2. tapyu revised this gist Aug 3, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion _preamble.typ
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // *** packages ***
    #import "@preview/unify:0.6.0": num,qty,numrange,qtyrange
    #import "@preview/pinit:0.1.4": * // pin things as you like
    #import "@preview/diverential:0.2.0": *
    #import "@preview/diverential:0.2.0": * // typesetting of differentials

    // *** operations ***

  3. tapyu revised this gist Aug 3, 2024. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions _preamble.typ
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    // *** packages ***
    #import "@preview/unify:0.6.0": num,qty,numrange,qtyrange
    #import "@preview/pinit:0.1.4": * // pin things as you like
    #import "@preview/diverential:0.2.0": *

    // *** operations ***

  4. tapyu revised this gist Aug 3, 2024. 2 changed files with 9 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion .typst_general_snippets.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    ## Typst general snippets

    Some must-have Typst general snippets
    - Must-have Typst general snippets
    - Preamble
    7 changes: 7 additions & 0 deletions snippets.typ → _preamble.typ
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,9 @@
    // *** packages ***
    #import "@preview/unify:0.6.0": num,qty,numrange,qtyrange
    #import "@preview/pinit:0.1.4": * // pin things as you like

    // *** operations ***

    // upright+bold (usually used for vectors and matrices
    #let bu(it) = [
    $bold(upright(it))$
    @@ -8,6 +14,7 @@
    $#lr(#sym.angle.l #it #sym.angle.r)$
    ]

    // Real/Imag
    #let Re(it) = $op("Re") {#it}$
    #let Im(it) = $op("Im") {#it}$
    // expected value
  5. tapyu revised this gist Jun 26, 2024. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions nice_table.typ
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #let tablemaker(data, header: none) = {
    let items = data.pairs()
    table(
    columns: 2,
    stroke: (x, y) => if y == 0 { (bottom: black) },
    ..if header != none { (table.header(..header),) } else { () },
    ..items.map(((key, value)) => ([*#key*], [#value])).flatten()
    )
    }

    #tablemaker(
    (
    Name: [John],
    Age: 25,
    Data: [Cool]
    ),
    header: ([*Property*], [*Value*])
    )
  6. tapyu revised this gist May 31, 2024. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions algorithm.typ
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #show regex("function|if|or|and|return"): it => strong(it)
    #set list(marker: none, indent: .7em)
    #show list: it => block(
    stroke: (left: 1pt),
    outset: (left: -.3em, top: .8em),
    inset: (left: -.4em, top: -.5em, bottom: .3em),
    {
    place(dx: .6em + .5pt, dy: -.3em, line(length: .6em))
    it
    place(dx: .6em + .5pt, dy: .3em, line(length: .6em))
    },
    )
    function fib$(n)$:
    - if $n < 0$:
    - return null
    - if $n = 0$ or $n = 1$:
    - return $n$
    - return fib$(n-1) +$ fib$(n-2)$
  7. tapyu revised this gist May 29, 2024. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion snippets.typ
    Original file line number Diff line number Diff line change
    @@ -11,4 +11,9 @@
    #let Re(it) = $op("Re") {#it}$
    #let Im(it) = $op("Im") {#it}$
    // expected value
    #let exp(it) = $op("E ")[#it]$
    #let exp(it) = $op("E ")[#it]$
    // script font
    #let scr(it) = [
    #set text(stylistic-set: 1)
    $cal(it)$
    ]
  8. tapyu revised this gist May 29, 2024. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions snippets.typ
    Original file line number Diff line number Diff line change
    @@ -8,5 +8,7 @@
    $#lr(#sym.angle.l #it #sym.angle.r)$
    ]

    #let Re(it) = $op("Re") {it}$
    #let Im(it) = $op("Im") {it}$
    #let Re(it) = $op("Re") {#it}$
    #let Im(it) = $op("Im") {#it}$
    // expected value
    #let exp(it) = $op("E ")[#it]$
  9. tapyu revised this gist May 27, 2024. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion snippets.typ
    Original file line number Diff line number Diff line change
    @@ -6,4 +6,7 @@
    // <a>
    #let avg(it) = [
    $#lr(#sym.angle.l #it #sym.angle.r)$
    ]
    ]

    #let Re(it) = $op("Re") {it}$
    #let Im(it) = $op("Im") {it}$
  10. tapyu revised this gist May 27, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snippets.typ
    Original file line number Diff line number Diff line change
    @@ -5,5 +5,5 @@

    // <a>
    #let avg(it) = [
    lr(#sym.angle.l #it #sym.angle.r)
    $#lr(#sym.angle.l #it #sym.angle.r)$
    ]
  11. tapyu revised this gist May 27, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snippets.typ
    Original file line number Diff line number Diff line change
    @@ -5,5 +5,5 @@

    // <a>
    #let avg(it) = [
    #sym.angle.l #it #sym.angle.r
    lr(#sym.angle.l #it #sym.angle.r)
    ]
  12. tapyu revised this gist May 27, 2024. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions snippets.typ
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,3 @@
    #let bu(it) = [
    $bold(upright(it))$
    ]

    // upright+bold (usually used for vectors and matrices
    #let bu(it) = [
    $bold(upright(it))$
  13. tapyu revised this gist May 27, 2024. 2 changed files with 13 additions and 0 deletions.
    File renamed without changes.
    13 changes: 13 additions & 0 deletions snippets.typ
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #let bu(it) = [
    $bold(upright(it))$
    ]

    // upright+bold (usually used for vectors and matrices
    #let bu(it) = [
    $bold(upright(it))$
    ]

    // <a>
    #let avg(it) = [
    #sym.angle.l #it #sym.angle.r
    ]
  14. tapyu created this gist May 27, 2024.
    3 changes: 3 additions & 0 deletions .typst_general_snippets
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    ## Typst general snippets

    Some must-have Typst general snippets