Skip to content

Instantly share code, notes, and snippets.

@VincentTam
Created May 19, 2025 15:03
Show Gist options
  • Save VincentTam/57695e42d64bffabfbed42ca19905b72 to your computer and use it in GitHub Desktop.
Save VincentTam/57695e42d64bffabfbed42ca19905b72 to your computer and use it in GitHub Desktop.
Typst Sample Article (two column layout)
// format the paper
#set page(
paper: "us-letter",
margin: (x: 1in, y: 1in),
numbering: "1/1",
header: [
#grid(columns: (1fr, 1fr, 1fr),
align(left)[BamDone Exmaple-002.typ],
align(center)[Center],
align(right)[Right]
)
]
)
// format the text
#set par(
justify: true
)
#set text(
font: "New Computer Modern Math",
size: 10pt
)
// equation formatting
#set math.equation(numbering: "(1)", supplement: [Equation])
// format tables
#show figure.where(
kind: table
): set figure.caption(position: top)
#align(center, text(24pt)[#smallcaps("This is an Amazing Title")]
)
// author list
#grid(columns: (1fr, 1fr, 1fr),
fill: none,
column-gutter: 2pt,
align(center)[Author 1\
Org 1\
Addr 1],
align(center)[Author 2\
Org 2\
Addr 2],
align(center)[Author 3\
Org 3\
Addr 3]
)
#v(-1em)
#grid(columns: (2cm, 1fr, 1fr, 2cm),
fill: none,
column-gutter: 2pt,
[],
align(center)[Author 4\
Org 4\
Addr 4],
align(center)[Author 5\
Org 5\
Addr 5],
[]
)
// abstract
#grid(columns: (1cm, 1fr, 1cm),
fill: none,
column-gutter: 2pt,
[],[*Abstract*: #lorem(40)],[]
)
// Make the document 2-column page format
#show: rest => columns(2, rest)
= Introduction
#lorem(90)
= Outline
+ Introduction
- Prior art
- What's new?
+ Methods
+ #text(fill: blue)[Results]
+ Conclusions
= Figures
The typst logo is seen in @fig-typstLogo.
#figure(caption: [This is a typst logo],
image("typst_logo.jpeg", width: 20%)
)<fig-typstLogo>
= Tables
#lorem(30)
The results are shown in @tab-exampleTable.
#figure(caption: [An Exmaple Table], kind: table,
table(columns: 3, stroke: none,
[*Column A*], [*Column 2*], [*Column III*],
table.hline(start: 0, stroke: 1pt),
[#lorem(3)], [#lorem(3)], [#image("typst_logo.jpeg", width: 1cm)],
[#lorem(3)], [$alpha$], [#lorem(5)],
[#lorem(3)], [#lorem(3)], [#lorem(3)],
)
)<tab-exampleTable>
= Equations
#lorem(30)
An inline equation is one as we see here: $f(x)=sin(x)$
#lorem(10) $g(x) = cos(x)$. #lorem(20)
An out of line equation can be seen below:
$
f(x) = sin(x)
$<eq-sin>
$
g(x) = e^(3x)
$<eq-exponent>
$
h(x) = integral_0^1 tan(x) upright(d)x
$<eq-integral>
$
delta = sqrt(x^2 + y^2)
$<eq-distance>
The first formulation is seen in @eq-sin. The second formulation is seen in @eq-exponent.
= Prior Art
#lorem(30)
The first paper was @段刚山2009柯西不等式的推广. The second book is @pearson1905problem.
#bibliography("refs.bib", style: "american-psychological-association")
@article{段刚山2009柯西不等式的推广,
title={柯西不等式的推广},
author={段刚山},
journal={中学数学研究 (华南师范大学): 上半月},
number={1},
pages={40--41},
year={2009}
}
@article{pearson1905problem,
title={The problem of the random walk},
author={Pearson, Karl},
journal={Nature},
volume={72},
number={1867},
pages={342--342},
year={1905},
publisher={Nature Publishing Group UK London}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment