Skip to content

brycewang-stanford/Auto-Empirical-Research-Skills / skills/35-bahayonghang-academic-writing-skills/skills/typst-paper

typst-paper

Verified

Typst academic paper assistant for existing `.typ` paper projects in English or Chinese. Use this skill whenever the user wants to compile, audit, or improve a Typst paper, including format checks, bibliography validation for BibTeX or Hayagriva, grammar/sentence/logic review, expression polishing, translation, title optimization, pseudocode review, algorithm block cleanup, de-AI editing, experiment-section review, table structure validation, three-line table generation, abstract structure diagnosis, or journal adaptation. Trigger even when the user only mentions one Typst file, one bibliography issue, one pseudocode block, one section rewrite, "three-line table", "check abstract", or "reformat for another journal". Also trigger when the user mentions ".typ files", "typst compile error", "typst export", "typst bibliography", `algorithm-figure`, `lovelace`, or `algorithmic` even without saying the word "Typst" explicitly.

FileKindSize
SKILL.mdskill md7.5 KB
agents/openai.yamlconfig330 B
evals/evals.jsonconfig7.3 KB
examples/bibliography-and-title.mdmarkdown509 B
examples/compile-and-format.mdmarkdown495 B
examples/expression-and-translation.mdmarkdown554 B
references/ABSTRACT_STRUCTURE.mdmarkdown4.9 KB
references/BEST_PRACTICES.mdmarkdown391 B
references/CITATION_STYLES.mdmarkdown4.2 KB
references/CITATION_VERIFICATION.mdmarkdown4.9 KB
references/COMMON_ERRORS.mdmarkdown5.3 KB
references/DEAI_GUIDE.mdmarkdown14.9 KB
references/JOURNAL_ABBREVIATIONS.mdmarkdown3.5 KB
references/JOURNAL_ADAPTATION_WORKFLOW.mdmarkdown3.6 KB
references/NUMBER_UNIT_GUIDE.mdmarkdown2.3 KB
references/REVIEWER_PERSPECTIVE.mdmarkdown4.9 KB
references/STYLE_GUIDE.mdmarkdown7.9 KB
references/TABLE_GUIDE.mdmarkdown2.6 KB
references/TEMPLATES.mdmarkdown2.5 KB
references/TERMINOLOGY.mdmarkdown9.9 KB
references/TRANSLATION_GUIDE.mdmarkdown11.4 KB
references/TYPST_SYNTAX.mdmarkdown9.8 KB
references/VENUES.mdmarkdown13.0 KB
references/WRITING_PHILOSOPHY.mdmarkdown6.7 KB
references/modules/ABSTRACT.mdmarkdown1.2 KB
references/modules/ADAPT.mdmarkdown1.3 KB
references/modules/BIBLIOGRAPHY.mdmarkdown1.3 KB
references/modules/CAPTION.mdmarkdown2.1 KB
references/modules/COMPILE.mdmarkdown1.2 KB
references/modules/DEAI.mdmarkdown2.8 KB
references/modules/EXPERIMENT.mdmarkdown3.8 KB
references/modules/EXPRESSION.mdmarkdown1.6 KB
references/modules/FORMAT.mdmarkdown1.1 KB
references/modules/GRAMMAR.mdmarkdown1.1 KB
references/modules/LOGIC.mdmarkdown5.4 KB
references/modules/PSEUDOCODE.mdmarkdown1.4 KB
references/modules/SENTENCES.mdmarkdown726 B
references/modules/TABLES.mdmarkdown1.3 KB
references/modules/TITLE.mdmarkdown7.3 KB
references/modules/TRANSLATION.mdmarkdown1.5 KB
references/modules/WORKFLOW.mdmarkdown706 B
scripts/analyze_abstract.pyscript17.3 KB
scripts/analyze_experiment.pyscript11.1 KB
scripts/analyze_grammar.pyscript3.6 KB
scripts/analyze_logic.pyscript18.8 KB
scripts/analyze_sentences.pyscript3.6 KB
scripts/check_format.pyscript11.3 KB
scripts/check_pseudocode.pyscript8.6 KB
scripts/check_references.pyscript14.1 KB
scripts/check_tables.pyscript9.8 KB
scripts/compile.pyscript8.1 KB
scripts/deai_batch.pyscript10.2 KB
scripts/deai_check.pyscript19.2 KB
scripts/generate_table.pyscript6.7 KB
scripts/improve_expression.pyscript3.2 KB
scripts/online_bib_verify.pyscript11.9 KB
scripts/optimize_title.pyscript16.9 KB
scripts/parsers.pyscript8.0 KB
scripts/translate_academic.pyscript4.2 KB
scripts/verify_bib.pyscript15.1 KB

references/TYPST_SYNTAX.md

View on GitHub
# Typst Syntax Reference for Academic Writing


## Table of Contents

- [Basic Syntax](#basic-syntax)
  - [Text Formatting](#text-formatting)
  - [Headings](#headings)
  - [Paragraphs](#paragraphs)
  - [Lists](#lists)
- [Math](#math)
  - [Inline Math](#inline-math)
  - [Display Math](#display-math)
  - [Common Math Symbols](#common-math-symbols)
- [Figures and Tables](#figures-and-tables)
  - [Figures](#figures)
  - [Tables](#tables)
- [Citations and References](#citations-and-references)
  - [Citations](#citations)
  - [Bibliography](#bibliography)
  - [Citation Styles](#citation-styles)
- [Page Setup](#page-setup)
  - [Basic Page Configuration](#basic-page-configuration)
  - [Two-Column Layout](#two-column-layout)
  - [Headers and Footers](#headers-and-footers)
- [Text Formatting](#text-formatting)
  - [Font Settings](#font-settings)
  - [Paragraph Settings](#paragraph-settings)
  - [Heading Settings](#heading-settings)
- [Cross-References](#cross-references)
  - [Labels](#labels)
  - [References](#references)
- [Functions and Variables](#functions-and-variables)
  - [Define Variables](#define-variables)
  - [Define Functions](#define-functions)
  - [Conditional Content](#conditional-content)
- [Show Rules (Styling)](#show-rules-styling)
  - [Style Headings](#style-headings)
  - [Style Links](#style-links)
  - [Style Figures](#style-figures)
- [Comments](#comments)
- [Special Characters](#special-characters)
- [Code Blocks](#code-blocks)
- [Common Patterns for Academic Papers](#common-patterns-for-academic-papers)
  - [Title and Authors](#title-and-authors)
  - [Abstract](#abstract)
  - [Acknowledgments](#acknowledgments)
- [Tips for Academic Writing](#tips-for-academic-writing)
- [Resources](#resources)

---

## Basic Syntax

### Text Formatting

```typst
// Bold
*bold text*

// Italic
_italic text_

// Code/Monospace
`code text`

// Combining
*_bold and italic_*
```

### Headings

```typst
= Level 1 Heading
== Level 2 Heading
=== Level 3 Heading
==== Level 4 Heading
```

### Paragraphs

```typst
// Normal paragraph
This is a paragraph. It will be justified if you set par(justify: true).

// Line break within paragraph
This is line one. \
This is line two.

// Paragraph break (blank line)
First paragraph.

Second paragraph.
```

### Lists

```typst
// Unordered list
- Item 1
- Item 2
  - Nested item 2.1
  - Nested item 2.2
- Item 3

// Ordered list
+ First item
+ Second item
  + Nested item 2.1
  + Nested item 2.2
+ Third item

// Description list
/ Term 1: Definition 1
/ Term 2: Definition 2
```

---

## Math

### Inline Math

```typst
The equation $x^2 + y^2 = z^2$ is the Pythagorean theorem.

Variables $a$, $b$, and $c$ are defined as...
```

### Display Math

```typst
// Centered display math
$ x = (a + b) / 2 $

// Numbered equation with label
$ y = m x + c $ <eq:line>

// Multi-line equations
$ x &= a + b \
  &= c + d $
```

### Common Math Symbols

```typst
// Greek letters
$alpha, beta, gamma, Delta, Sigma$

// Operators
$sum, product, integral, partial$

// Relations
$<=, >=, !=, approx, equiv$

// Fractions
$a/b$ or $(a)/(b)$

// Subscripts and superscripts
$x_i, x^2, x_i^2$

// Functions
$sin(x), cos(x), log(x), exp(x)$

// Matrices
$ mat(
  a, b;
  c, d
) $

// Cases
$ f(x) = cases(
  0 "if" x < 0,
  1 "if" x >= 0
) $
```

---

## Figures and Tables

### Figures

```typst
// Basic figure
#figure(
  image("figure.png", width: 80%),
  caption: [Description of the figure.]
) <fig:example>

// Figure with multiple images
#figure(
  grid(
    columns: 2,
    gutter: 1em,
    image("fig1.png"),
    image("fig2.png"),
  ),
  caption: [Two subfigures side by side.]
) <fig:comparison>

// Reference in text
As shown in @fig:example, the method...
```

### Tables

```typst
// Basic table
#figure(
  table(
    columns: 3,
    [*Method*], [*Accuracy*], [*Time*],
    [Baseline], [85.2%], [10ms],
    [Ours], [92.1%], [12ms],
  ),
  caption: [Comparison of methods.]
) <tab:results>

// Table with alignment
#figure(
  table(
    columns: (auto, 1fr, 1fr),
    align: (left, center, center),
    [*Method*], [*Accuracy*], [*Time*],
    [Baseline], [85.2%], [10ms],
    [Ours], [92.1%], [12ms],
  ),
  caption: [Results with custom alignment.]
) <tab:aligned>

// Reference in text
@tab:results shows the comparison...
```

---

## Citations and References

### Citations

```typst
// Single citation
According to @smith2020, the method...

// Multiple citations
Recent studies @smith2020 @jones2021 @wang2022 show...

// Citation in parentheses
The method has been studied extensively (@smith2020, @jones2021).

// Suppress author name (numeric style)
The method [1] shows...
```

### Bibliography

```typst
// BibTeX file
#bibliography("references.bib", style: "ieee")

// Hayagriva YAML file
#bibliography("references.yml", style: "apa")

// Multiple files
#bibliography(("refs1.bib", "refs2.bib"), style: "ieee")
```

### Citation Styles

```typst
// IEEE (numeric)
#bibliography("refs.bib", style: "ieee")

// APA (author-year)
#bibliography("refs.bib", style: "apa")

// Chicago
#bibliography("refs.bib", style: "chicago-author-date")

// MLA
#bibliography("refs.bib", style: "mla")

// GB/T 7714-2015 (Chinese)
#bibliography("refs.bib", style: "gb-7714-2015")
```

---

## Page Setup

### Basic Page Configuration

```typst
#set page(
  paper: "a4",              // or "us-letter"
  margin: 2.5cm,            // all sides
  // or
  margin: (x: 2.5cm, y: 3cm),  // horizontal and vertical
  // or
  margin: (top: 3cm, bottom: 3cm, left: 2.5cm, right: 2.5cm),
)
```

### Two-Column Layout

```typst
#set page(
  paper: "us-letter",
  margin: 1in,
  columns: 2,
  column-gutter: 0.33in
)
```

### Headers and Footers

```typst
#set page(
  header: [
    #set text(8pt)
    #smallcaps[Conference Name 2024]
    #h(1fr)
    Draft Version
  ],
  footer: [
    #set text(8pt)
    #h(1fr)
    #counter(page).display("1")
    #h(1fr)
  ]
)
```

---

## Text Formatting

### Font Settings

```typst
#set text(
  font: "Times New Roman",
  size: 11pt,
  lang: "en"
)

// Chinese font
#set text(
  font: ("Source Han Serif", "Noto Serif CJK SC"),
  size: 12pt,
  lang: "zh",
  region: "cn"
)

// Multiple fonts (fallback)
#set text(
  font: ("Linux Libertine", "Times New Roman", "Arial")
)
```

### Paragraph Settings

```typst
#set par(
  justify: true,              // Justify text
  leading: 0.65em,            // Line spacing
  first-line-indent: 1.5em,   // First line indent
  spacing: 0.65em             // Space between paragraphs
)
```

### Heading Settings

```typst
// Numbered headings
#set heading(numbering: "1.1")

// Custom heading style
#show heading.where(level: 1): it => {
  set text(size: 14pt, weight: "bold")
  block(above: 1.5em, below: 1em, it)
}
```

---

## Cross-References

### Labels

```typst
// Label a figure
#figure(...) <fig:example>

// Label an equation
$ x = y + z $ <eq:sum>

// Label a section
= Introduction <sec:intro>

// Label a table
#figure(table(...)) <tab:results>
```

### References

```typst
// Reference a figure
As shown in @fig:example, ...

// Reference an equation
Equation @eq:sum defines...

// Reference a section
See @sec:intro for details.

// Reference a table
@tab:results presents the results.

// Custom reference text
See #ref(<fig:example>, supplement: [Figure])
```

---

## Functions and Variables

### Define Variables

```typst
#let author = "John Smith"
#let title = "My Paper Title"

// Use variables
#author wrote #title.
```

### Define Functions

```typst
#let emphasis(body) = {
  text(weight: "bold", fill: blue, body)
}

// Use function
This is #emphasis[important].
```

### Conditional Content

```typst
#let draft = true

#if draft [
  *DRAFT VERSION*
]

#if not draft [
  Final version content
]
```

---

## Show Rules (Styling)

### Style Headings

```typst
#show heading.where(level: 1): it => {
  set text(size: 16pt, weight: "bold")
  block(above: 1.5em, below: 1em, it)
}

#show heading.where(level: 2): it => {
  set text(size: 14pt, weight: "bold")
  block(above: 1.2em, below: 0.8em, it)
}
```

### Style Links

```typst
#show link: it => {
  set text(fill: blue)
  underline(it)
}
```

### Style Figures

```typst
#show figure: it => {
  set align(center)
  it
}
```

---

## Comments

```typst
// Single-line comment

/* Multi-line
   comment */

// Comments are ignored during compilation
```

---

## Special Characters

```typst
// Non-breaking space
word~word

// Em dash
word---word

// En dash
word--word

// Ellipsis
word...

// Quotes
"double quotes"
'single quotes'
```

---

## Code Blocks

```typst
// Inline code
The function `main()` is the entry point.

// Code block
```python
def hello():
    print("Hello, world!")
```
```

---

## Common Patterns for Academic Papers

### Title and Authors

```typst
#align(center)[
  #text(size: 16pt, weight: "bold")[
    Your Paper Title
  ]
  
  #v(0.5em)
  
  Author Name#super[1], Co-author Name#super[2]
  
  #v(0.3em)
  
  #text(size: 10pt)[
    #super[1]University Name, #super[2]Institution Name \
    #link("mailto:author@email.com")
  ]
]
```

### Abstract

```typst
#heading(outlined: false, numbering: none)[Abstract]

Your abstract text here...

#v(0.5em)

*Keywords:* keyword1, keyword2, keyword3
```

### Acknowledgments

```typst
#heading(outlined: false, numbering: none)[Acknowledgments]

This work was supported by...
```

---

## Tips for Academic Writing

1. **Use labels consistently**: `<fig:name>`, `<tab:name>`, `<eq:name>`, `<sec:name>`
2. **Keep figures readable**: Use `width: 80%` or similar
3. **Number equations**: Use `$ ... $ <eq:label>` for important equations
4. **Consistent formatting**: Use `#set` rules at the beginning
5. **Modular content**: Use `#include "section.typ"` for large documents
6. **Version control**: Typst files are plain text, perfect for Git

---

## Resources

- [Typst Documentation](https://typst.app/docs/)
- [Typst Universe](https://typst.app/universe/) - Templates and packages
- [Typst Tutorial](https://typst.app/docs/tutorial/)
- [Typst Reference](https://typst.app/docs/reference/)

rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 196kUpdated Claude CodeCodexVerifiedInstall