Loading...
Loading...
Compare original and translation side by side
(item1, item2)(key: value, key2: value2)[markup content](item1, item2)(key: value, key2: value2)[markup content]gh searchsearxng-searchgh searchsearxng-searchundefinedundefinedundefinedundefinedsearxng-searchcurl "http://localhost:<searxng-port>/search?q=typst+diagram&format=json&categories=repos" | jq '.results[] | select(.engines[] == "github")'searxng-searchcurl "http://localhost:<searxng-port>/search?q=typst+diagram&format=json&categories=repos" | jq '.results[] | select(.engines[] == "github")'fletcherdraftingtablexfletcherdraftingtablex()[]#let name(params) = { ... }context()[]#let name(params) = { ... }context[]()arr[0]arr.at(0)#[]{}[]()arr[0]arr.at(0)#[]{}// Define custom functions for document elements
#let important(body) = {
box(
fill: red.lighten(80%),
stroke: red + 1pt,
inset: 8pt,
body
)
}
// Use state for counters
#let example-counter = state("examples", 1)
#let example(body) = context {
let num = example-counter.get()
important[Example #num: #body]
example-counter.update(x => x + 1)
}
// Arrays for data
#let factions = (
(name: "Merchants", color: blue),
(name: "Artisans", color: green)
)
// Iterate and render
#for faction in factions [
- #text(fill: faction.color, faction.name)
]// 为文档元素定义自定义函数
#let important(body) = {
box(
fill: red.lighten(80%),
stroke: red + 1pt,
inset: 8pt,
body
)
}
// 使用状态管理计数器
#let example-counter = state("examples", 1)
#let example(body) = context {
let num = example-counter.get()
important[示例 #num: #body]
example-counter.update(x => x + 1)
}
// 数组存储数据
#let factions = (
(name: "Merchants", color: blue),
(name: "Artisans", color: green)
)
// 遍历并渲染
#for faction in factions [
- #text(fill: faction.color, faction.name)
]typsttypst querytypst query the_document.typ "heading.where(level: 1)" | jq ".[].body.text"querytypsttypst querytypst query the_document.typ "heading.where(level: 1)" | jq ".[].body.text"query#import "@preview/package:version"draftinggentle-cluesshowyboxitemizecetzfletcherchronostimelineyherodotlilaqtablemcmarkerpolyluxsuijizebrawlovelaceconchordeqalcjlyfishpyrunner#import "@preview/package:version"draftinggentle-cluesshowyboxitemizecetzfletcherchronostimelineyherodotlilaqtablemcmarkerpolyluxsuijizebrawlovelaceconchordeqalcjlyfishpyrunner#import "@preview/template-name:version": *#show: template-name.with(param: value, ...)#import "@preview/bubble:0.2.2": bubble
// Some templates (like bubble) don't use the standard metadata set by `#set document(...)` (for now?),
// so we factor it out:
#let doc-md = (
title: [My report],
author: "Claude",
date: datetime(year: 2025, month: 12, day: 8) // ALWAYS include explicit date in code (so we don't default to date of PDF build)
)
#set document(..doc-md)
#show: bubble.with(
..doc-md,
date: doc-md.date.display("[day]-[month]-[year]"), // some templates want a string here, not a `datetime` object, so we override date here
subtitle: "A detailed analysis",
affiliation: "Your Organization",
main-color: rgb("#FF6B35"),
color-words: ("important", "key", "critical"),
)
// Your content follows
= Introduction
...#show:charged-ieeebubblemodern-cv#import "@preview/template-name:version": *#show: template-name.with(param: value, ...)#import "@preview/bubble:0.2.2": bubble
// 某些模板(如bubble)目前不使用`#set document(...)`设置的标准元数据,因此我们单独提取:
#let doc-md = (
title: [我的报告],
author: "Claude",
date: datetime(year: 2025, month: 12, day: 8) // 代码中始终包含明确日期(避免默认使用PDF生成日期)
)
#set document(..doc-md)
#show: bubble.with(
..doc-md,
date: doc-md.date.display("[day]-[month]-[year]"), // 某些模板此处需要字符串而非`datetime`对象,因此我们在此覆盖日期
subtitle: "详细分析",
affiliation: "你的组织",
main-color: rgb("#FF6B35"),
color-words: ("important", "key", "critical"),
)
// 以下是你的内容
= 引言
...#show:charged-ieeebubblemodern-cv@ref-name@ref-name#set document(
title: "Document Title",
author: "Your Name",
date: auto,
)
#set page(
paper: "a4",
margin: (x: 2.5cm, y: 2.5cm),
numbering: "1",
)
#set text(size: 11pt)
#set par(justify: true)
#set heading(numbering: "1.")
// Title page
#align(center)[
#text(size: 24pt, weight: "bold")[Document Title]
#v(1cm)
#text(size: 14pt)[Your Name]
#v(0.5cm)
#datetime.today().display()
]
#pagebreak()
// Table of contents
#outline(title: "Table of Contents", indent: auto)
#pagebreak()
// Main content
= Introduction
Your introduction text...
= Methods
...
= Results
...
= Conclusion
...
#pagebreak()
// Bibliography
#bibliography("refs.bib", title: "References", style: "ieee")#set document(
title: "文档标题",
author: "你的姓名",
date: auto,
)
#set page(
paper: "a4",
margin: (x: 2.5cm, y: 2.5cm),
numbering: "1",
)
#set text(size: 11pt)
#set par(justify: true)
#set heading(numbering: "1.")
// 标题页
#align(center)[
#text(size: 24pt, weight: "bold")[文档标题]
#v(1cm)
#text(size: 14pt)[你的姓名]
#v(0.5cm)
#datetime.today().display()
]
#pagebreak()
// 目录
#outline(title: "目录", indent: auto)
#pagebreak()
// 主要内容
= 引言
你的引言文本...
= 方法
...
= 结果
...
= 结论
...
#pagebreak()
// 参考文献
#bibliography("refs.bib", title: "参考文献", style: "ieee")#import "@preview/charged-ieee:0.1.4": *
#show: ieee.with(
title: "Your Paper Title",
authors: (
(name: "Author One", email: "author1@example.com"),
(name: "Author Two", email: "author2@example.com"),
),
abstract: [
Your abstract text here...
],
index-terms: ("keyword1", "keyword2", "keyword3"),
bibliography: bibliography("refs.bib"), // the ieee template takes care of bibliography itself. That's not always the case
)
// Content starts immediately
= Introduction
Your introduction text...
= Methods
...
= Results
...
= Conclusion
...#import "@preview/charged-ieee:0.1.4": *
#show: ieee.with(
title: "你的论文标题",
authors: (
(name: "作者一", email: "author1@example.com"),
(name: "作者二", email: "author2@example.com"),
),
abstract: [
你的摘要文本...
],
index-terms: ("keyword1", "keyword2", "keyword3"),
bibliography: bibliography("refs.bib"), // IEEE模板会自行处理参考文献,并非所有模板都如此
)
// 内容直接开始
= 引言
你的引言文本...
= 方法
...
= 结果
...
= 结论
...@preview/package:version@preview/package:version#{ }#()key: value(elem,)#{ }#()key: value(elem,)#include "file.typ"typst compile doc.typ output.pdf --pages 1-5typst compile --timings doc.typ#include "file.typ"typst compile doc.typ output.pdf --pages 1-5typst compile --timings doc.typ