forked from EduCraft/curriculum-project-hub
6f46aa708a
Fixes the numbering bug (single pattern "一、" reused across levels → level-2
rendered "二、一、…"). display now takes a `config` dict; heading numbering uses
numbly per level — framework default ("{1:一}、","{1:1}.{2:1}","{1:1}.{2:1}.{3:1}")
→ 一、 / 1.1 / 1.1.1 — overridable via config.numbering.heading from the
engineering file (ADR-0009's file-resident override path, the layer whose absence
caused the bug). Verified: grep "二、一" = 0 across all smoke PDFs.
Adds @preview/numbly:0.1.0 (pure typst, zero transitive deps), VENDORED in-repo
at render/vendor/typst-packages/preview/numbly/0.1.0/ for network-free CI;
resolve via --package-cache-path render/vendor/typst-packages. parts contract +
student/teacher field visibility unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
84 lines
2.5 KiB
Typst
84 lines
2.5 KiB
Typst
// Shared hand-written sample lesson exercising all 4 kinds.
|
||
// Content field values are plain content blocks — exactly what the Rust driver
|
||
// would hand us via `include`.
|
||
|
||
#let info = (
|
||
title: "向量与几何 · 示例讲义",
|
||
author: ("张老师", "李老师"),
|
||
)
|
||
|
||
#let parts = (
|
||
// segment — with NESTED headings so per-level numbering is visible:
|
||
// level-1 `=` should render `一、`, level-2 `==` should render `1.1`
|
||
// (NOT the old buggy `二、一、`).
|
||
(
|
||
kind: "segment",
|
||
textbook: [
|
||
= 平面向量的数量积
|
||
|
||
本节研究平面向量的基本运算。设 $arrow(a)$、$arrow(b)$ 为平面内两个向量,
|
||
其数量积定义为 $arrow(a) dot arrow(b) = |arrow(a)| |arrow(b)| cos theta$,
|
||
其中 $theta$ 为两向量的夹角。
|
||
|
||
== 坐标表示
|
||
|
||
在直角坐标系下,若 $arrow(a) = (x_1, y_1)$、$arrow(b) = (x_2, y_2)$,则
|
||
$arrow(a) dot arrow(b) = x_1 x_2 + y_1 y_2$。
|
||
|
||
== 几何意义
|
||
|
||
数量积等于一个向量的模与另一向量在其方向上投影之积。
|
||
],
|
||
),
|
||
// example WITH source
|
||
(
|
||
kind: "example",
|
||
source: "2024 高考甲卷",
|
||
problem: [
|
||
已知 $arrow(a) = (1, 2)$,$arrow(b) = (3, -1)$,求 $arrow(a) dot arrow(b)$。
|
||
],
|
||
solution: [
|
||
由坐标公式,$arrow(a) dot arrow(b) = 1 times 3 + 2 times (-1) = 3 - 2 = 1$。
|
||
],
|
||
),
|
||
// example WITHOUT source
|
||
(
|
||
kind: "example",
|
||
problem: [
|
||
求向量 $arrow(a) = (3, 4)$ 的模长 $|arrow(a)|$。
|
||
],
|
||
solution: [
|
||
$|arrow(a)| = sqrt(3^2 + 4^2) = sqrt(25) = 5$。
|
||
],
|
||
),
|
||
// lemma WITH proof
|
||
(
|
||
kind: "lemma",
|
||
stmt: [
|
||
对任意向量 $arrow(a)$、$arrow(b)$,有 $|arrow(a) dot arrow(b)| <= |arrow(a)| |arrow(b)|$。
|
||
],
|
||
proof: [
|
||
由数量积定义 $arrow(a) dot arrow(b) = |arrow(a)| |arrow(b)| cos theta$,
|
||
又 $|cos theta| <= 1$,故 $|arrow(a) dot arrow(b)| = |arrow(a)| |arrow(b)| |cos theta| <= |arrow(a)| |arrow(b)|$。
|
||
$qed$
|
||
],
|
||
),
|
||
// lemma WITHOUT proof (proof key omitted entirely)
|
||
(
|
||
kind: "lemma",
|
||
stmt: [
|
||
两个非零向量垂直当且仅当其数量积为零,即 $arrow(a) perp arrow(b) <==> arrow(a) dot arrow(b) = 0$。
|
||
],
|
||
),
|
||
// sop
|
||
(
|
||
kind: "sop",
|
||
sop: [
|
||
求两向量夹角的标准步骤:
|
||
+ 计算数量积 $arrow(a) dot arrow(b)$;
|
||
+ 分别计算模长 $|arrow(a)|$、$|arrow(b)|$;
|
||
+ 代入 $cos theta = (arrow(a) dot arrow(b)) / (|arrow(a)| |arrow(b)|)$ 求出 $theta$。
|
||
],
|
||
),
|
||
)
|