Scripst is a template package based on Typst, offering a set of simple and efficient document templates suitable for everyday documents, assignments, notes, papers, and other scenarios.
็ฎไฝไธญๆ | English
๐ Contents
- ๐ Contents
- ๐ Features
- ๐ฆ Installation
- ๐ Using Scripst
- ๐ง Template Parameters
- ๐
countblock
Module - โจ Template Examples and Explanations
- ๐ Contributing
- ๐ Fonts
- ๐ Dependencies
- ๐ License
- ๐ฏ TODO
๐ Features
- High Extensibility: Modular design, easy to extend the templates.
- Multilingual Design: Localization for different languages.
- Supports module
countblock
, which allows custom names and colors, includes a built-in counter, and can be referenced anywhere in the document. It can be used for theorems, problems, notes, etc. For more details, see ๐countblock
Module.
๐ฆ Installation
Install Typst
Make sure Typst is installed. You can install it using the following commands:
sudo apt install typst # Debian/Ubuntu
sudo pacman -S typst # Arch Linux
winget install --id Typst.Typst # Windows
brew install typst # macOS
Or refer to the Typst official documentation for more information.
Download Scripst Template
Should you need to use the template locally, or should you need to make adjustments to the template, you can download the Scripst template manually.
Method 1: Download Manually
- Visit the Scripst GitHub repository
- Click the
<> Code
button - Choose
Download ZIP
- After extraction, place the template files into your project directory.
Suggested directory structure
project/
โโโ src/
โ โโโ main.typ
โ โโโ components.typ
โโโ pic/
โ โโโ image.jpg
โโโ main.typ
โโโ chap1.typ
โโโ chap2.typ
If the template is stored in the src/
directory, import it like this:
#import "src/main.typ": *
Method 2: Use Typst Local Package Management
You can manually download Scripst and store it in:
~/.local/share/typst/packages/preview/scripst/1.1.0 # Linux
%APPDATA%\typst\packages\preview\scripst\1.1.0 # Windows
~/Library/Application Support/typst/packages/preview/scripst/1.1.0 # macOS
or using these commands:
cd {data-dir}/typst/packages/preview/scripst
git clone https://github.com/An-314/scripst.git 1.1.0
Where data-dir
refers to Typstโs data directory, such as ~/.local/share/typst
for Linux, %APPDATA%\typst
for Windows, and ~/Library/Application Support/typst
for macOS.
Then import directly in your Typst file:
#import "@preview/scripst:1.1.0": *
Now you can use the Scripst template.
Use typst init
to quickly create a project:
typst init @preview/scripst:1.1.0 project_name
๐ Using Scripst
Import Scripst Template
Import the template at the beginning of your Typst file:
#import "@preview/scripst:1.1.0": *
Create article
Document
#show: scripst.with(
title: [How to Use Scripst],
info: [This is an article template],
author: ("Author1", "Author2", "Author3"),
time: datetime.today().display(),
abstract: [Abstract content],
keywords: ("Keyword1", "Keyword2", "Keyword3"),
contents: true,
content-depth: 2,
matheq-depth: 2,
lang: "en",
)
๐ง Template Parameters
Parameter | Type | Default Value | Description |
---|---|---|---|
template |
str |
"article" |
Choose template ("article" , "book" , "report" ) |
title |
content , str , none |
"" |
Document title |
info |
content , str , none |
"" |
Document subtitle or supplementary information |
author |
array |
() |
List of authors |
time |
content , str , none |
"" |
Document date |
abstract |
content , str , none |
none |
Document abstract |
keywords |
array |
() |
Keywords |
preface |
content , str , none |
none |
Preface |
font-size |
length |
11pt |
Font size |
contents |
bool |
false |
Whether to generate a table of contents |
content-depth |
int |
2 |
Table of contents depth |
matheq-depth |
int |
2 |
Math equation numbering depth |
lang |
str |
"zh" |
Language ("zh" , "en" , "fr" , etc.) |
๐ countblock
Module
The countblock
module is a customizable module where you can set the name and color, and it comes with a built-in counter that can be referenced anywhere in the document. It can be used to create blocks for theorems, definitions, problems, notes, and more.
Below is an example of a countblock
module:
Creating and Registering a countblock
Scripst provides several default countblock
modules, which already have preset names, colors, and registered counters:
#let cb = (
"thm": ("Theorem", color.blue),
"def": ("Definition", color.green),
"prob": ("Problem", color.purple),
"prop": ("Proposition", color.purple-grey),
"ex": ("Example", color.green-blue),
"note": ("Note", color.grey),
"cau": ("โ ๏ธ", color.red),
)
You can also define your own countblock
modules:
#let cb = add-countblock("test", "This is a test", teal) // Define a "test" countblock
#show: register-countblock.with("test") // Register the countblock
This allows you to use the test
module in your document.
Using countblock
You can use the countblock
module in the document as follows:
#countblock(
name,
subname,
count: true,
cb: cb,
lab: none,
)[...]
Parameter descriptions:
Parameter | Type | Default Value | Description |
---|---|---|---|
name |
str |
"" |
Name of the module |
subname |
str |
"" |
The name of the specific block |
count |
bool |
true |
Whether to count or not |
cb |
dict |
cb |
The countblock dictionary |
lab |
str , none |
none |
Label |
For example:
#countblock("thm", subname: [_Fermat's Last Theorem_], lab: "fermat", cb)[
No three $a, b, c \in \mathbb{N}^+$ can satisfy the equation
$
a^n + b^n = c^n
$
for any integer value of $n$ greater than 2.
]
#proof[Cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet.]
Fermat did not provide a public proof for @fermat.
This will create a theorem block and allow it to be referenced in the document.
Encapsulating the countblock
Module
You can encapsulate the countblock
module into a function for repeated use in the document:
#let test = countblock.with("test", cb)
This allows you to use the test
function in the document:
#test[...]
Additionally, the default countblock
modules provided by Scripst have already been encapsulated, allowing you to use them directly as #theorem
, #definition
, #problem
, #proposition
, #example
, #note
, and #caution
.
โจ Template Examples and Explanations
Article
Book
Book Demo (Only in Simplified Chinese)
Report
Report Demo (Only in Simplified Chinese)
๐ Contributing
Feel free to submit issues or pull requests! If you have any improvement suggestions, join the discussion.
- GitHub Repository: Scripst
- Issue Feedback: Submit an issue to discuss
๐ Fonts
This project uses the following fonts by default:
- Primary fonts: CMU Serif, Consolas
- Alternative fonts: Linux Libertine
- Chinese fonts such as SimSun, SimHei, KaiTi, etc.
If using these default fonts, please make sure they are correctly installed. Otherwise, replace them if needed in ./src/configs.typ
.
๐ Dependencies
For certain content, Scripst uses the following Typst packages:
๐ License
This project is licensed under the MIT License.
๐ฏ TODO
- [ ] Add
beamer
template - [ ] Add more configuration options