Loading...
Loading...
Compare original and translation side by side
typst --version # Check if installedtypst --version # Check if installedtypst compile document.typ && echo "Success" || echo "Failed"pdftotexttypst compile document.typ && echo "Success" || echo "Failed"pdftotext| Error | Cause | Fix |
|---|---|---|
| "unknown variable" | Undefined identifier | Check spelling, ensure |
| "expected X, found Y" | Type mismatch | Check function signature in docs |
| "file not found" | Bad import path | Paths resolve relative to the current file |
| "unknown font" | Font not installed | Use system fonts or web-safe alternatives |
| "maximum function call depth exceeded" | Deep recursion | Limit recursion, use iteration instead |
| 错误信息 | 原因 | 修复方法 |
|---|---|---|
| "unknown variable" | 未定义标识符 | 检查拼写,确保在使用前用 |
| "expected X, found Y" | 类型不匹配 | 查阅文档中的函数签名 |
| "file not found" | 导入路径错误 | 路径相对于当前文件解析 |
| "unknown font" | 字体未安装 | 使用系统字体或网页安全替代字体 |
| "maximum function call depth exceeded" | 递归过深 | 限制递归深度,改用迭代代替 |
#set page(paper: "a4", margin: 2cm)
#set text(size: 11pt)
= Title
Content goes here.#set page(paper: "a4", margin: 2cm)
#set text(size: 11pt)
= Title
Content goes here.| Task | Reference |
|---|---|
| Language basics (types, functions, operators) | basics.md |
| State, context, query, XML parsing | advanced.md |
| Templates, styling, set/show rules | template.md |
| Package development, publishing | package.md |
| Converting from Markdown/LaTeX | conversion.md |
| Debugging techniques (pdftotext, repr, measure) | debug.md |
| Performance profiling (timings, hotspots) | perf.md |
| 任务 | 参考文档 |
|---|---|
| 语言基础(类型、函数、运算符) | basics.md |
| 状态、上下文、查询、XML解析 | advanced.md |
| 模板、样式、set/show规则 | template.md |
| 包开发、发布 | package.md |
| 从Markdown/LaTeX转换 | conversion.md |
| 调试技巧(pdftotext、repr、measure) | debug.md |
| 性能分析(计时、热点) | perf.md |
--root--rootstate()contextquery()state()contextquery()typst.tomltypst.tomlpdftotextrepr()measure()place()pdftotextrepr()measure()place()--timings--timingsundefinedundefined
**When to use `--root`**: If your document imports files using `/`-prefixed paths (e.g., `#import "/lib/utils.typ"`), set `--root` to the directory those paths should resolve from. See [basics.md](basics.md) for path resolution rules.
**何时使用`--root`**:如果你的文档使用以"/"开头的路径导入文件(例如`#import "/lib/utils.typ"`),请将`--root`设置为这些路径应解析到的目录。路径解析规则详见[basics.md](basics.md)。| Package | Purpose |
|---|---|
| Code block formatting with syntax highlighting |
| Theorem environments |
| LaTeX math rendering |
| CJK typography utilities |
| BibTeX parsing |
#import "@preview/codly:1.3.0": *| 包名称 | 用途 |
|---|---|
| 带语法高亮的代码块格式化 |
| 定理环境 |
| LaTeX数学公式渲染 |
| CJK排版工具 |
| BibTeX解析 |
#import "@preview/codly:1.3.0": *examples/| Example | Description |
|---|---|
| basic-document.typ | Complete beginner document with all common elements |
| template-report.typ | Reusable template with headers, counters, note boxes |
| package-example/ | Minimal publishable package with submodules |
examples/| 示例 | 描述 |
|---|---|
| basic-document.typ | 包含所有常见元素的完整入门文档 |
| template-report.typ | 带页眉、计数器、注释框的可复用模板 |
| package-example/ | 包含子模块的最小可发布包 |
brew install typstcargo install typst-cliwinget install typstbrew install typstcargo install typst-cliwinget install typst