Skip to content

Commit a79c951

Browse files
authored
lasaveur:0.1.4 and touying2video:0.1.0 (#2092)
1 parent 2ef6539 commit a79c951

File tree

6 files changed

+463
-0
lines changed

6 files changed

+463
-0
lines changed

Diff for: packages/preview/lasaveur/0.1.4/README.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Typst-lasaveur
2+
3+
This is a Typst package for speedy mathematical input, inspired by [vim-latex](https://github.com/vim-latex/vim-latex). This project is named after my Vim plugin [vimtex-lasaveur](https://github.com/yangwenbo99/vimtex-lasaveur), which ports the operations in vim-latex to [vimtex](https://github.com/lervag/vimtex).
4+
5+
## Usages in Typst
6+
7+
Either use the file released in "Releases" or import using the following command:
8+
9+
```typst
10+
#import "@preview/lasaveur:0.1.4": *
11+
```
12+
13+
This script generates a Typst library that defines shorthand commands for various mathematical symbols and functions. Here's an overview of what it provides and how a user can use it:
14+
15+
1. Mathematical Functions:
16+
- Usage: `f<key>(argument)`
17+
- Examples: `fh(x)` for hat, `ft(x)` for tilde, `f2(x)` for square root
18+
2. Font Styles:
19+
- Usage: `f<key>(argument)`
20+
- Examples: `fb(x)` for bold, `fbb(x)` for blackboard bold, `fca(x)` for calligraphic
21+
3. Greek Letters:
22+
- Usage: `k<key>`
23+
- Examples: `ka` for α (alpha), `kb` for β (beta), `kG` for Γ (capital Gamma)
24+
4. Common Mathematical Symbols:
25+
- Usage: `g<key>`
26+
- Examples: `g8` for ∞ (infinity), `gU` for ∪ (union), `gI` for ∩ (intersection)
27+
5. LaTeX-compatible Symbols:
28+
- Usage: Direct LaTeX command names
29+
- Examples: `partial` for ∂, `infty` for ∞, `cdot` for ⋅
30+
6. Arrows:
31+
- Usage: `ar.<key>`
32+
- Examples: `ar.l` for ←, `ar.r` for →, `ar.lr` for ↔
33+
34+
Users can employ these shorthands in their Typst documents to quickly input mathematical symbols and functions. The exact prefix for each category (like `f` for functions or `k` for Greek letters) can be customized using command-line arguments when running the script.
35+
36+
For instance, in a Typst document, after importing the generated library, a user could write:
37+
38+
```typst
39+
$fh(x) + ka + g8 + ar.r$
40+
```
41+
42+
This would produce: x̂ + α + ∞ + →
43+
44+
The script provides a wide range of symbols covering most common mathematical notations, making it easier and faster to type complex mathematical expressions in Typst -- especially for users migrating from vim-latex.
45+
46+
## Accompanying Vim Syntax File
47+
48+
The syntax file provides more advanced and correct concealing for both Typst's built-in math syntax and the lasaveur shorthands. Download the syntax file from the "Releases" section and place it in your `~/.vim/after/syntax/` directory. The `syntax.vim` file in the repo is supposed to be used by the generation script and it _will not work_ if directly sourced in Vim.
49+
50+
## License
51+
52+
Following the previous project (`vimtex-lasaveur`), this project is licensed under the [WTFPL (Limited-liability license)](https://github.com/yangwenbo99/vimtex-lasaveur/blob/main/LICENSE.txt). Basically, this means you can do whatever you want with it, but you cannot hold me liable for anything.
53+
54+
However, to satisfy the requirement for the Typst package repository, all files of `typst-lasaveur` that are published in the Typst package repository are also licensed under the MIT license.

Diff for: packages/preview/lasaveur/0.1.4/typst-lasaveur.typ

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#let fh(a) = $hat(#a)$
2+
#let ft(a) = $tilde(#a)$
3+
#let f2(a) = $sqrt(#a)$
4+
#let fb(a) = $bold(#a)$
5+
#let fbb(a) = $bb(#a)$
6+
#let fca(a) = $cal(#a)$
7+
#let g6 = $diff$
8+
#let g8 = $infinity$
9+
#let g0 = $nothing$
10+
#let go = $circle.stroked.tiny$
11+
#let g_ = $without$
12+
#let gd = $dot$
13+
#let gt = $times$
14+
#let gU = $union.big$
15+
#let gI = $inter.big$
16+
#let gb = $subset$
17+
#let gbeq = $subset.eq$
18+
#let gbne = $subset.neq$
19+
#let gbneq = $subset.neq$
20+
#let gp = $supset$
21+
#let gpeq = $supset.eq$
22+
#let gpne = $supset.neq$
23+
#let gpneq = $supset.neq$
24+
#let gal = $angle.l$
25+
#let gar = $angle.r$
26+
#let gV = $nabla$
27+
#let gdd = $dot.double$
28+
#let gddd = $dot.triple$
29+
#let gdddd = $dot.quad$
30+
#let g1 = $tilde.op$
31+
#let ka = $alpha$
32+
#let kb = $beta$
33+
#let kc = $chi$
34+
#let kd = $delta$
35+
#let ke = $epsilon.alt$
36+
#let kee = $epsilon$
37+
#let kf = $phi.alt$
38+
#let kff = $phi$
39+
#let kg = $gamma$
40+
#let kh = $eta$
41+
#let ki = $iota$
42+
#let kk = $kappa$
43+
#let kl = $lambda$
44+
#let km = $mu$
45+
#let kn = $nu$
46+
#let ko = $omicron$
47+
#let kp = $pi$
48+
#let kq = $theta$
49+
#let kr = $rho$
50+
#let ks = $sigma$
51+
#let kt = $tau$
52+
#let ku = $upsilon$
53+
#let kv = $sigma.alt$
54+
#let kw = $omega$
55+
#let kx = $xi$
56+
#let ky = $psi$
57+
#let kz = $zeta$
58+
#let kD = $Delta$
59+
#let kG = $Gamma$
60+
#let kL = $Lambda$
61+
#let kX = $Xi$
62+
#let kS = $Sigma$
63+
#let kU = $Upsilon$
64+
#let kF = $Phi$
65+
#let kW = $Omega$
66+
#let partial = $diff$
67+
#let infty = $infinity$
68+
#let circ = $circle.stroked.tiny$
69+
#let setminus = $without$
70+
#let cdot = $dot.op$
71+
#let bigcup = $union.big$
72+
#let bigcap = $inter.big$
73+
#let prod = $product$
74+
#let to = $arrow.r$
75+
#let implies = $arrow.r.double$
76+
#let gets = $arrow.l$
77+
#let iff = $arrow.l.r.double.long$
78+
#let cdots = $dots.h.c$
79+
#let vdots = $dots.v$
80+
#let ddots = $dots.down$
81+
#let int = $integral$
82+
#let iint = $integral.double$
83+
#let iiint = $integral.triple$
84+
#let oint = $integral.cont$
85+
#let sim = $tilde.op$
86+
#let ne = $eq.not$
87+
#let ar = (
88+
l: $arrow.l$,
89+
r: $arrow.r$,
90+
t: $arrow.t$,
91+
b: $arrow.b$,
92+
lr: $arrow.r.long$,
93+
ll: $arrow.l.long$,
94+
llr: $arrow.l.r.long$,
95+
dl: $arrow.l.double$,
96+
dr: $arrow.r.double$,
97+
dlr: $arrow.l.r.double$,
98+
dt: $arrow.t.double$,
99+
db: $arrow.b.double$,
100+
ldl: $arrow.l.long.double$,
101+
ldr: $arrow.r.long.double$,
102+
ldlr: $arrow.l.r.long.double$,
103+
)

Diff for: packages/preview/lasaveur/0.1.4/typst.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "lasaveur"
3+
version = "0.1.4"
4+
entrypoint = "typst-lasaveur.typ"
5+
authors = ["Paul Yang <https://github.com/yangwenbo99>"]
6+
license = "MIT"
7+
description = "Porting vim-latex's math shorthands to Typst. An accommendating vim syntax file is provided in the repo."
8+
9+
repository = "https://github.com/yangwenbo99/typst-lasaveur"
10+
keywords = ["math", "shorthand", "shortcut"]
11+
categories = ["utility"]
12+
compiler="0.13.0"

Diff for: packages/preview/touying2video/0.1.0/README.md

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# touying2video
2+
3+
The tools converts a touying-typ presentation slide to a presentation video with voice over.
4+
It is currently in its proof-of-concept stage.
5+
To use this tool, import `p2vmeta.typ` in your Typst file. ~~Currently, it only works with a patched version of `touying-typ`.~~ (No longer needed, as we have found a workaround.) The file to import (`p2vmeta.typ`) is available in the `demo` directory. A demo video is available at <https://youtu.be/lJ7X57xG7V8>.
6+
7+
8+
## Quick start
9+
10+
A demo file is available at `demo/demo.typ`. To use the tool, add the following lines at the beginning of your Typst file:
11+
12+
```typst
13+
#import "@preview/touying:0.6.1": *
14+
// #import "p2vmeta.typ": * // The typst portion of the tool
15+
#import "@preview/touying2video:0.1.0": *
16+
17+
#t2sdefaults( // Set the default settings for the tool
18+
transition: "fade",
19+
transition_duration: 0.8,
20+
)
21+
22+
#pdfpc.config(// You may also set defaults for the pdfpc module in touying-typ
23+
disable-markdown: false,
24+
default-transition: (
25+
type: "fade",
26+
duration-seconds: 1,
27+
),
28+
)
29+
30+
#import themes.university: *
31+
32+
#import "@preview/numbly:0.1.0": numbly
33+
34+
#show: university-theme.with(
35+
// ... The setting for your theme
36+
)
37+
```
38+
39+
**Very import**: At the end of your Typst file, add the following lines:
40+
41+
```typst
42+
#context t2s-file(here())
43+
```
44+
45+
After compiling the Typst file, run the following command to generate the video:
46+
47+
```bash
48+
python main.py path/to/your/typst/file.typ
49+
```
50+
51+
52+
## Reference
53+
54+
The following tags are provided:
55+
- `t2sdefaults`: the default settings for the tool
56+
- `duration_logical`: the duration of each (physical) slide in seconds
57+
- `transition`: the transition effect between slides, currently, only `"fade"` and `"none"` are supported
58+
- `transition_duration`: the duration of the transition effect in seconds, if the transition is set to `"none"`, this parameter must be 0.
59+
- `t2s`: the content of speech
60+
- By default, a transition to a new slide with a speech will not happen until the current speech finishes.
61+
- `duration`: the duration of the slide in seconds
62+
- `logical`: the duration of the (logical) slide in seconds
63+
- Please note that this parameter will behave funny when you have a speech in the slide that is not starting at the first physical slide of this logical slide.
64+
- `physical`: the duration of each (physical) slide in seconds
65+
- The following special values are allowed:
66+
- `"fk"`, i.e., `f` followed by an integer: until the finish of the k-th speech in the logical slide, k starts from 1
67+
<!-- - `"fk+t"`, i.e., `f` followed by an integer, a `+`, and a float: until the finish of the k-th speech in the logical slide plus the specified time-->
68+
- Note that, the time specified here is more similar to "minimal time", because the tool will wait for the speech to finish before transitioning to the next slide (if the next slide has a speech)
69+
- `video-overlay`
70+
- `start`: in which physical slide in this logical slide that the video overlay starts
71+
- All dimensions can be in pixels or percentage of the slide size
72+
- one of width or height can be negative, in which case, the size is calculated from the other dimension, preserving the aspect ratio of the video
73+
- if both are negative, the video is not resized
74+
- Currently, typst and touying do not support putting a video in the presentation slides. However, we provide a method to insert video clips in the presentation video.
75+
76+
77+
## Video overlay in the presentation video
78+
79+
80+
Example:
81+
82+
```typst
83+
video-overlay(
84+
start_from: 2,
85+
video: "img/animations/video1.mp4",
86+
x: 20%, // relative to the slide width
87+
y: 40%, // relative to the slide height
88+
width: 18%, // relative to the slide width
89+
)
90+
```
91+
92+
93+
## License
94+
95+
[aGPL-3.0](https://github.com/yangwenbo99/touying2video/blob/main/LICENSE)

0 commit comments

Comments
 (0)