refactor: create own template based on basic-resume

This commit is contained in:
Felix Schröter 2025-02-26 00:51:56 +01:00
parent 7934af3ad8
commit 8f783151ef
Signed by: felschr
GPG key ID: 671E39E6744C807D
2 changed files with 218 additions and 1 deletions

217
src/lib/main.typ Normal file
View file

@ -0,0 +1,217 @@
#import "@preview/scienceicons:0.0.6": orcid-icon
// based on https://github.com/stuxf/basic-typst-resume-template
#let resume(
author: "",
author-position: left,
personal-info-position: left,
pronouns: "",
location: "",
email: "",
github: "",
linkedin: "",
phone: "",
personal-site: "",
orcid: "",
accent-color: "#000000",
font: "New Computer Modern",
paper: "a4",
body,
) = {
// Sets document metadata
set document(author: author, title: author)
// Document-wide formatting, including font and margins
set text(
// LaTeX style font
font: font,
size: 10pt,
lang: "en",
// Disable ligatures so ATS systems do not get confused when parsing fonts.
ligatures: false,
)
set page(
margin: 1.5cm,
paper: paper,
)
// Link styles
show link: underline
// Small caps for section titles
show heading.where(level: 2): it => [
#pad(top: 0pt, bottom: -10pt, [#smallcaps(it.body)])
#line(length: 100%, stroke: 1pt)
]
// Accent Color Styling
show heading: set text(fill: rgb(accent-color))
show link: set text(fill: rgb(accent-color))
// Name will be aligned left, bold and big
show heading.where(level: 1): it => [
#set align(author-position)
#set text(
weight: 700,
size: 20pt,
)
#pad(it.body)
]
// Level 1 Heading
[= #(author)]
// Personal Info Helper
let contact-item(value, prefix: "", link-type: "") = {
if value != "" {
if link-type != "" {
link(link-type + value)[#(prefix + value)]
} else {
value
}
}
}
// Personal Info
pad(
top: 0.25em,
align(personal-info-position)[
#{
let items = (
contact-item(pronouns),
contact-item(phone),
contact-item(location),
contact-item(email, link-type: "mailto:"),
contact-item(github, link-type: "https://"),
contact-item(linkedin, link-type: "https://"),
contact-item(personal-site, link-type: "https://"),
contact-item(
orcid,
prefix: [#orcid-icon(color: rgb("#AECD54"))orcid.org/],
link-type: "https://orcid.org/",
),
)
items.filter(x => x != none).join(" | ")
}
],
)
// Main body.
set par(justify: true)
body
}
// Generic two by two component for resume
#let generic-two-by-two(
top-left: "",
top-right: "",
bottom-left: "",
bottom-right: "",
) = {
[
#top-left #h(1fr) #top-right \
#bottom-left #h(1fr) #bottom-right
]
}
// Generic one by two component for resume
#let generic-one-by-two(
left: "",
right: "",
) = {
[
#left #h(1fr) #right
]
}
// Cannot just use normal --- ligature becuase ligatures are disabled for good reasons
#let dates-helper(
start-date: "",
end-date: "",
) = {
start-date + " " + $dash.em$ + " " + end-date
}
// Section components below
#let edu(
institution: "",
dates: "",
degree: "",
gpa: "",
location: "",
) = {
generic-two-by-two(
top-left: strong(institution),
top-right: location,
bottom-left: emph(degree),
bottom-right: emph(dates),
)
}
#let work(
title: "",
dates: "",
company: "",
location: "",
) = {
generic-two-by-two(
top-left: strong(title),
top-right: dates,
bottom-left: company,
bottom-right: emph(location),
)
}
#let project(
role: "",
name: "",
url: "",
dates: "",
) = {
generic-one-by-two(
left: {
if role == "" {
[*#name* #if url != "" and dates != "" [ (#link("https://" + url)[#url])]]
} else {
[*#role*, #name #if url != "" and dates != "" [ (#link("https://" + url)[#url])]]
}
},
right: {
if dates == "" and url != "" {
link("https://" + url)[#url]
} else {
dates
}
},
)
}
#let certificates(
name: "",
issuer: "",
url: "",
date: "",
) = {
[
*#name*, #issuer
#if url != "" {
[ (#link("https://" + url)[#url])]
}
#h(1fr) #date
]
}
#let extracurriculars(
activity: "",
dates: "",
) = {
generic-one-by-two(
left: strong(activity),
right: dates,
)
}

View file

@ -1,4 +1,4 @@
#import "@preview/basic-resume:0.2.3": *
#import "lib/main.typ": *
#let name = "Felix Schröter"
#let location = "Lüneburg, Germany"