Skip to content

Commit

Permalink
Update to v0.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Leedehai committed Jul 30, 2023
1 parent 1522ac6 commit 6c3047a
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 27 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Current semantic version: `0.7`. [Manual](https://github.com/Leedehai/typst-physics/blob/master/physica-manual.pdf).

Available at [https://typst.app/docs/packages/](https://typst.app/docs/packages/).

This [Typst](https://typst.app) package provides handy typesetting utilities for
physics, including:
* Braces,
Expand All @@ -22,12 +24,24 @@ everybody", this package was renamed from `physics` to `physica`.

## A quick look

Typst source: [demo.typ](demo.typ). See the [manual](https://github.com/Leedehai/typst-physics/blob/master/physica-manual.pdf) for more details.
See the [manual](https://github.com/Leedehai/typst-physics/blob/master/physica-manual.pdf) for more details.

![demo](https://user-images.githubusercontent.com/18319900/236073825-e91b4601-7e92-490b-a7e4-e9e405a2147b.png)

## Using phyiscs in your Typst document

### With `typst` package management (recommended)

See https://github.com/typst/packages.

```
#import "@preview/physica:0.7.5": *
$op("curl")(op("grad") f) = curl (grad f)$
```

### Without `typst` package management

* To use the `physics` package, simply insert `#import "physics.typ": *` at the
beginning of your document.
* To reduce the possibility of name collisions, you may want to import the
Expand Down
Binary file modified physica-manual.pdf
Binary file not shown.
33 changes: 9 additions & 24 deletions physica-manual.typ
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023 Leedehai
// This document is shared under the Creative Commons BY-ND 4.0 license.

#let version = "0.7.4"
#let version = "0.7.5"

#set page(
numbering: "1/1",
Expand Down Expand Up @@ -30,6 +30,9 @@

*NOTE (2023-04-02):* #linkurl("Typst", "https://typst.app") is version 0.x and evolving, and this package evolves with it. Also, the package itself is under development and fine-tuning. While the major version stays 0, no backward compatibility is guaranteed.

Indexed at
#linkurl("https://typst.app/docs/packages/", "https://typst.app/docs/packages/").

#outline(indent: true)
#pagebreak(weak: true)

Expand All @@ -47,31 +50,13 @@ This manual itself was generated using the Typst CLI and the `physica` package,

#v(1em)

// TODO: update usage when Typst has package management.

- To use the `physica` package, you may import names specifically:
```typ
#import "physica.typ": curl, grad
The expression $op("curl")(op("grad") f) ident curl (grad f) = 0$ is not
foreign to any trained eye in physical mathematics.
```

- or you may simply import all names:
```typ
#import "physica.typ": *
With `typst`'s #linkurl("package management", "https://github.com/typst/packages"):

The expression $op("curl")(op("grad") f) ident curl (grad f)$ is not foreign
to any trained eye in physical mathematics.
```

- sometimes you may want to import the names under a name space:
```typ
#import "physica.typ"
```
#import "@preview/physica:0.7.5": *
The expression $op("curl")(op("grad") f) ident physica.curl (physica.grad f)$
is not foreign to any trained eye in physical mathematics.
```
$op("curl")(op("grad") f) = curl (grad f)$
```

= The symbols

Expand Down
2 changes: 1 addition & 1 deletion physica.typ
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023 Leedehai
// Use of this code is governed by a MIT license in the LICENSE.txt file.
// Current version: 0.7.3. Please see physics-manual.pdf for user docs.
// Current version: 0.7.5. Please see physics-manual.pdf for user docs.

// Returns whether a Content object holds an integer. The caller is responsible
// for ensuring the input argument is a Content object.
Expand Down
42 changes: 42 additions & 0 deletions pkg-repo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python3

import argparse
import os
import shutil
import sys

from pathlib import Path

FILES = [
"physica.typ",
"README.md",
"typst.toml",
"LICENSE.txt",
]

def copy_file(dest, file):
source_path = Path(__file__, "..", file).resolve()
target_path = Path(dest, file).resolve()
print(f"{source_path} -->\n\t{target_path}")
shutil.copyfile(source_path, target_path)

def copy_files(args):
# https://github.com/typst/packages/tree/main#submission-guidelines
physica_dir = Path(args.repo_dir, 'packages', 'preview', f'physica-{args.version}')
os.makedirs(physica_dir, exist_ok = False)
print(f"Destination: {physica_dir}")
for file in FILES:
copy_file(physica_dir, file)
print("ls:")
print(os.listdir(physica_dir))

def main():
parser = argparse.ArgumentParser('Copy files to official Typst packages repo')
parser.add_argument('--version', required=True, help="version, e.g. 0.7.5")
parser.add_argument('--repo-dir', required=True, help="repo root")
args = parser.parse_args()

copy_files(args)

if __name__ == "__main__":
sys.exit(main())
2 changes: 1 addition & 1 deletion typst.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "physica"
version = "0.7.4"
version = "0.7.5"
entrypoint = "physica.typ"
license = "MIT"
description = "Physics notations."
Expand Down

0 comments on commit 6c3047a

Please sign in to comment.