mirror of
https://github.com/kristoferssolo/Quantum-Computation-Cheatsheet.git
synced 2025-10-21 19:50:34 +00:00
Initial commit
This commit is contained in:
parent
4f63961ed2
commit
dfb086e03b
4
.github/workflows/typst.yml
vendored
4
.github/workflows/typst.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
cache-dependency-path: requirements.typ
|
||||
- name: Compile Typst files
|
||||
run: |
|
||||
typst compile main.typ main.pdf
|
||||
typst compile --font-path=assets/fonts main.typ quantum-computation-cheatsheet.pdf
|
||||
- name: Upload PDF file
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@ -40,4 +40,4 @@ jobs:
|
||||
with:
|
||||
name: "${{ github.ref_name }} — ${{ env.DATE }}"
|
||||
files: |
|
||||
main.pdf
|
||||
quantum-computation-cheatsheet.pdf
|
||||
|
||||
Binary file not shown.
BIN
assets/fonts/TimesNewRoman/Times.TTF
Normal file
BIN
assets/fonts/TimesNewRoman/Times.TTF
Normal file
Binary file not shown.
BIN
assets/fonts/TimesNewRoman/Times.ttf
Normal file
BIN
assets/fonts/TimesNewRoman/Times.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/TimesNewRoman/Timesbd.TTF
Normal file
BIN
assets/fonts/TimesNewRoman/Timesbd.TTF
Normal file
Binary file not shown.
BIN
assets/fonts/TimesNewRoman/Timesbi.TTF
Normal file
BIN
assets/fonts/TimesNewRoman/Timesbi.TTF
Normal file
Binary file not shown.
BIN
assets/fonts/TimesNewRoman/Timesi.TTF
Normal file
BIN
assets/fonts/TimesNewRoman/Timesi.TTF
Normal file
Binary file not shown.
196
layout.typ
Normal file
196
layout.typ
Normal file
@ -0,0 +1,196 @@
|
||||
#import "@preview/i-figured:0.2.4"
|
||||
#import "@preview/tablex:0.0.9": tablex
|
||||
#import "@preview/headcount:0.1.0": *
|
||||
|
||||
#let indent = 1cm
|
||||
|
||||
#let indent-par(body) = par(h(indent) + body)
|
||||
|
||||
#let project(
|
||||
title: [],
|
||||
authors: (),
|
||||
body,
|
||||
) = {
|
||||
set document(author: authors)
|
||||
|
||||
set page(
|
||||
columns: 2,
|
||||
margin: (
|
||||
left: 10mm,
|
||||
right: 10mm,
|
||||
top: 10mm,
|
||||
bottom: 10mm,
|
||||
),
|
||||
number-align: center,
|
||||
paper: "a4",
|
||||
)
|
||||
set text(
|
||||
font: (
|
||||
"Times New Roman",
|
||||
"New Computer Modern",
|
||||
),
|
||||
size: 12pt,
|
||||
hyphenate: auto,
|
||||
lang: "lv",
|
||||
region: "lv",
|
||||
)
|
||||
show raw: set text(
|
||||
font: (
|
||||
"JetBrainsMono NF",
|
||||
"JetBrains Mono",
|
||||
"Fira Code",
|
||||
),
|
||||
features: (calt: 0),
|
||||
)
|
||||
|
||||
show math.equation: set text(weight: 400)
|
||||
|
||||
// Formatting for regular text
|
||||
set par(justify: true, leading: 1em, first-line-indent: indent, spacing: 1em)
|
||||
show heading: set block(spacing: 1.5em)
|
||||
|
||||
set terms(separator: [ -- ])
|
||||
|
||||
// Headings
|
||||
set heading(numbering: "1.1.")
|
||||
show heading: it => {
|
||||
if it.level == 1 {
|
||||
text(12pt, align(center, upper(it)))
|
||||
} else {
|
||||
text(12pt, it)
|
||||
}
|
||||
""
|
||||
v(-1cm)
|
||||
}
|
||||
|
||||
// Start page numbering
|
||||
set page(numbering: "1", number-align: center)
|
||||
|
||||
// WARNING: remove before sending
|
||||
// outline(title: "TODOs", target: figure.where(kind: "todo"))
|
||||
/* --- Figure/Table config start --- */
|
||||
show heading: i-figured.reset-counters
|
||||
show figure: i-figured.show-figure.with(numbering: "1.1.")
|
||||
set figure(numbering: dependent-numbering("1.1"))
|
||||
set figure(placement: none)
|
||||
|
||||
show figure.where(kind: "i-figured-table"): set block(breakable: true)
|
||||
show figure.where(kind: "i-figured-table"): set figure.caption(position: top)
|
||||
show figure.where(kind: "attachment"): set figure.caption(position: top)
|
||||
show figure.where(kind: raw): set figure.caption(position: top)
|
||||
|
||||
|
||||
show figure: set par(justify: false) // disable justify for figures (tables)
|
||||
show figure.where(kind: table): set par(leading: 1em)
|
||||
show figure.where(kind: image): set par(leading: 0.75em)
|
||||
show figure.caption: set text(size: 11pt)
|
||||
|
||||
show figure.caption: it => {
|
||||
if it.kind == "i-figured-table" {
|
||||
return align(
|
||||
end,
|
||||
emph(it.counter.display(it.numbering) + " tabula ")
|
||||
+ text(weight: "bold", it.body),
|
||||
)
|
||||
}
|
||||
if it.kind == "i-figured-image" {
|
||||
return align(
|
||||
start,
|
||||
emph(it.counter.display(it.numbering) + " att. ")
|
||||
+ text(weight: "bold", it.body),
|
||||
)
|
||||
}
|
||||
if (
|
||||
it.kind
|
||||
in (
|
||||
"i-figured-raw",
|
||||
"i-figured-\"attachment\"",
|
||||
)
|
||||
) {
|
||||
return align(end, it.counter.display() + ". pielikums. " + text(it.body))
|
||||
}
|
||||
it
|
||||
}
|
||||
|
||||
// disable default reference suppliments
|
||||
set ref(supplement: it => { })
|
||||
|
||||
// Custom show rule for references
|
||||
show ref: it => {
|
||||
let el = it.element
|
||||
|
||||
if el == none {
|
||||
return it
|
||||
}
|
||||
|
||||
if el.func() == heading {
|
||||
return link(
|
||||
el.location(),
|
||||
numbering(el.numbering, ..counter(heading).at(el.location()))
|
||||
+ " "
|
||||
+ el.body,
|
||||
)
|
||||
}
|
||||
|
||||
if el.func() == figure {
|
||||
let kind = el.kind
|
||||
|
||||
// Map for different kinds of supplements
|
||||
let supplement_map = (
|
||||
i-figured-table: "tab.",
|
||||
i-figured-image: "att.",
|
||||
attachment: "pielikumu",
|
||||
)
|
||||
|
||||
|
||||
// Get the supplement value properly
|
||||
let supplement = if type(it.supplement) != function {
|
||||
it.supplement
|
||||
} else {
|
||||
if kind in supplement_map {
|
||||
supplement_map.at(kind)
|
||||
} else {
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
let number = if kind == "attachment" {
|
||||
(
|
||||
numbering(el.numbering, ..counter(figure.where(kind: kind)).at(
|
||||
el.location(),
|
||||
))
|
||||
+ "."
|
||||
) // Only add dot for attachments
|
||||
} else {
|
||||
numbering(el.numbering, ..counter(figure.where(kind: kind)).at(
|
||||
el.location(),
|
||||
)) // No extra dot for tables and images
|
||||
}
|
||||
|
||||
// Create counter based on the kind
|
||||
return link(
|
||||
el.location(),
|
||||
number
|
||||
+ if supplement != "" {
|
||||
" " + supplement
|
||||
} else {
|
||||
""
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
// Default case for non-figure elements
|
||||
it
|
||||
}
|
||||
/* --- Figure/Table config end --- */
|
||||
|
||||
set list(marker: ([•], [--], [\*], [·]))
|
||||
set enum(
|
||||
numbering: "1aiA)",
|
||||
) // TODO: make the same style as LaTeX: 1. | (a) | i. | A.
|
||||
|
||||
|
||||
outline(depth: 3, indent: 1cm, title: text(size: 14pt, "SATURS"))
|
||||
|
||||
body
|
||||
}
|
||||
7
main.typ
7
main.typ
@ -0,0 +1,7 @@
|
||||
#import "@preview/fletcher:0.5.7" as fletcher: diagram, edge, node
|
||||
#import "@preview/physica:0.9.5": bra, braket, ket, ketbra
|
||||
#import "@preview/quill:0.6.1": *
|
||||
#import "@preview/quill:0.6.1" as quill: tequila as tq
|
||||
#import "layout.typ": indent-par, project
|
||||
|
||||
#show: project.with(title: [Kvantu skaitļošana], authors: ("Kristofer Solo",))
|
||||
@ -0,0 +1,3 @@
|
||||
#import "@preview/fletcher:0.5.7"
|
||||
#import "@preview/physica:0.9.5"
|
||||
#import "@preview/quill:0.6.1"
|
||||
Loading…
Reference in New Issue
Block a user