Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:35:35 +08:00
commit a47452744f
6 changed files with 196 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
---
name: typst-physica
description: typst公式中的微分、偏微分方程编写latex公式转typst。
---
# 引用包
应在typst文档的开头引用包。公式编写、文档排版依赖`modern-cug-report`
用于如果已经引用了`modern-cug-report`,则无需再重复添加了。
```typst
#import "@local/modern-cug-report:0.1.3": *
#show: doc => template(doc, footer: "CUG水文气象学2025", header: "")
```
# 偏微分方程
- `(∂ theta) / (∂ t)`
`\frac{\partial \theta}{\partial t}`采用typst编写会非常简单`pdv(theta, t)`
```typst
(partial.diff theta) / (partial.diff t) // 是错误写法
pdv(theta, t) // 正确写法
```
- `(d theta) / (d t)`则是:`dv(theta, t)`
# text
typst公式中的本文需要使用引号
```typst
q_(infiltration) // 错误
q_("infiltration") // 正确
```
# fraction
- latex的`\frac{y}{x}`写成typst则是`y/x`
若分子、分母有多个变量则用括号括起来。例如latex的`\frac{y z}{x}`写成typst则是`(y z) / x`
# 排版
- 一级标题之前空两行,凸显章节的层次感。
- 第一个一级标题,不用空两行。

View File

@@ -0,0 +1,40 @@
// Copyright 2023 Leedehai
// Use of this code is governed by a MIT license in the LICENSE.txt file.
// For a manual on this package, see physica-manual.pdf.
#import "@local/modern-cug-report:0.1.3": *
#show: doc => template(doc, footer: "CUG水文气象学2025", header: "")
// #import "physica.typ": *
#show: super-T-as-transpose // Render "..^T" as transposed matrix
$
A^T, curl vb(E) = - pdv(vb(B), t),
quad
tensor(Lambda, +mu, -nu) = dmat(1, RR),
quad
f(x,y) dd(x, y),
quad
dd(vb(x), y, [3]),
quad
dd(x, y, 2, d: Delta, p: and),
quad
dv(phi, t, d: upright(D)) = pdv(phi, t) + vb(u) grad phi \
H(f) = hmat(f; x, y; delim: "[", big: #true),
quad
vb(v^a) = sum_(i=1)^n alpha_i vu(u^i),
quad
Set((x, y), pdv(f, x, y, [2,1]) + pdv(f, x, y, [1,2]) < epsilon) \
-1/c^2 pdv(, t, 2)psi + laplacian psi = (m^2c^2) / hbar^2 psi,
quad
ket(n^((1))) = sum_(k in.not D) mel(k^((0)), V, n^((0))) / (E_n^((0)) - E_k^((0))) ket(k^((0))),
quad
integral_V dd(V) (pdv(cal(L), phi) - partial_mu (pdv(cal(L), (partial_mu phi)))) = 0 \
dd(s, 2) = -(1-(2G M)/r) dd(t, 2) + (1-(2G M)/r)^(-1) dd(r, 2) + r^2 dd(Omega, 2)
$
$
"clk:" & signals("|1....|0....|1....|0....|1....|0....|1....|0..", step: #0.5em) \
"bus:" & signals(" #.... X=... ..... ..... X=... ..... ..... X#.", step: #0.5em)
$

View File

@@ -0,0 +1,36 @@
#import "@local/modern-cug-report:0.1.3": *
#show: doc => template(doc, footer: "CUG水文气象学2025", header: "")
== 1 Richards方程
Richards方程
$ pdv(theta, t) = nabla dot [K(theta) nabla H] + S $
其中:
- $theta$:体积含水量 [L^3/L^3]
- $t$:时间 [T]
- $S$:源汇项 [1/T]
总水头 $H$ 由基质势 $h$ 和重力势 $z$ 组成:
$ H = h + z $
== 2 质量守恒定律
对于土壤控制体积,质量守恒方程为:
$ pdv(rho theta, t) + nabla dot (rho q) = rho S $
假设水密度 $rho$ 为常数,简化为:
$ pdv(theta, t) + nabla dot q = S $
== 3 上边界层条件
上边界通常受大气条件控制,主要包括:
*降雨入渗条件:*
$ -K(theta) pdv(H, z) |_(z=0) = q_("infiltration") $
*蒸发条件:*
$ -K(theta) pdv(H, z) |_(z=0) = q_("evaporation") $