Typst

本文作为typst的笔记页,参考教程为 官方教程

基本内容:#

  • =表示标题
  • _表示斜体
  • *表示加粗
  • -表示无序列表,+表示有序列表
  • 使用 image函数来插入图像,使用函数时要以#image(params)的形式来调用。
    • 更进一步的,使用figure函数来为图表添加说明和标记,如下所示
      1
      2
      3
      4
      5
      6
      7
      8
      #figure(
      image("glacier.jpg", width: 70%),
      caption: [
      _Glaciers_ form an important part
      of the earth's climate system.
      ],
      label:'glaciers' // 可以在原文中通过 @glaciers的方式来引用该图片
      )
  • 使用bibliography函数引入.bib文件,并在原文中通过@引用文章名称的方式添加引用。
  • 使用$添加行内数学公式,$应当与其中的内容分开。例如$ 3*2 $,这里有几点需要注意:
    • typst中的数学公式很多不必再加反斜杠。例如 $ Q = rho A v + "time offset" $。中的rho即为$\rho$。
    • 如果上下标由多个部分组成,需要用()来扩起,比如sum_(i=0)
    • 每一个间隔出来的部分将会识别为一个语素,如果希望用一个短语来充当语素,应当添加双引号。
    • 分号可以直接使用/,这将会给出和\frac等价的效果。
    • 许多数学结构可以使用函数来生成其样式,此时不需要再使用#来指明调用。

格式:#

typst支持通过set函数指定需要设置属性的函数,比如

1
#set par(justify:true)

将会将所有文本段落左右对齐。概念化理解就是:set规则为将来该函数的所有调用设置默认参数值。

以下是一些常见的set的用法:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#set text(
font: "New Computer Modern",
size: 10pt
)
#set page(
paper: "a6",
margin: (x: 1.8cm, y: 1.5cm),
)
#set par(
justify: true,
leading: 0.52em,
)

= Introduction
In this report, we will explore the
various factors that influence fluid
dynamics in glaciers and how they
contribute to the formation and
behavior of these natural structures.

...

#align(center + bottom)[
#image("glacier.jpg", width: 70%)

*Glaciers form an important
part of the earth's climate
system.*
]