fix(pro-letter): update fixes for 0.12 (default font now Libertinus Serif)
This commit is contained in:
6 files changed
+389
No files matched your search
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Stephen Waits <steve@waits.net>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,113 @@
|
||||
# Business Letter Typst Template
|
||||
|
||||
This Typst template lets you create professional business letters effortlessly.
|
||||
|
||||
## Features
|
||||
|
||||
- **Flexible Styling**: Adjust fonts, sizes, and emphasis according to your preferences.
|
||||
- **Customizable Sender and Recipient Details**: Easily configure names,
|
||||
addresses, and contact information.
|
||||
- **Date and Subject Line**: Clearly define the date and subject of your letter.
|
||||
- **Attachment Listings**: Describe any attachments that accompany your letter.
|
||||
- **Notary Section**: Include an optional notary acknowledgment page.
|
||||
|
||||
## Usage
|
||||
|
||||
To use this template, import it and configure the parameters as shown:
|
||||
|
||||
```typst
|
||||
#import "@preview/pro-letter:0.1.1": pro-letter
|
||||
|
||||
#show: pro-letter.with(
|
||||
sender: (
|
||||
name: "Alexandra Bloom",
|
||||
street: "123 Blueberry Lane",
|
||||
city: "Wonderland",
|
||||
state: "NA",
|
||||
zip: "56789",
|
||||
phone: "+1-555-987-6543",
|
||||
email: "alex@bloomworld.net",
|
||||
),
|
||||
|
||||
recipient: (
|
||||
company: "Fantasy Finance Faucets",
|
||||
attention: "Treasury Team",
|
||||
street: "456 Dreamscape Ave",
|
||||
city: "Fabletown",
|
||||
state: "IM",
|
||||
zip: "12345",
|
||||
),
|
||||
|
||||
date: "January 15, 2025",
|
||||
|
||||
subject: "Account Closure Request",
|
||||
|
||||
signer: "Alexandra Bloom",
|
||||
|
||||
attachments: "Fae Council Closure Order.",
|
||||
)
|
||||
|
||||
I am writing to formally request the closure of the enchanted vault at Fantasy
|
||||
Finance Faucets held in my name, Alexandra Bloom.
|
||||
|
||||
Attached is the official Fae Council Closure Order for your verification and
|
||||
records.
|
||||
|
||||
The account is identified by the vault number: *12345FAE*.
|
||||
|
||||
As the rightful owner, I _authorize the closure of the aforementioned vault_ and
|
||||
_request that all enchanted funds be redirected to the Fae Council Reserve_.
|
||||
Please find the necessary details for the transfer enclosed.
|
||||
|
||||
Thank you for your prompt attention to this magical matter.
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### Address Information
|
||||
|
||||
Both `sender` and `recipient` parameters accept the following optional fields in
|
||||
the form of a dictionary. Include only the fields necessary for your letter:
|
||||
|
||||
- **`name`**: Full name of the person.
|
||||
- **`company`**: Company name.
|
||||
- **`attention`**: Department or individual to address within the company.
|
||||
- **`street`**: Street address.
|
||||
- **`city`**: City.
|
||||
- **`state`**: State or region.
|
||||
- **`zip`**: ZIP or postal code.
|
||||
- **`phone`**: Phone number.
|
||||
- **`email`**: Email address.
|
||||
|
||||
### Letter Details
|
||||
|
||||
- **`date`**: The date of the letter. Optional; defaults to none.
|
||||
- **`subject`**: The subject line of the letter. Optional; defaults to none.
|
||||
- **`salutation`**: The greeting in the letter. Optional; defaults to "To whom
|
||||
it may concern,".
|
||||
- **`closing`**: The closing line of the letter. Required; defaults to "Sincerely,".
|
||||
- **`signer`**: The name of the person signing the letter. Required.
|
||||
|
||||
### Additional Features
|
||||
|
||||
- **`attachments`**: Description of any attachments accompanying the letter.
|
||||
Optional; defaults to none.
|
||||
- **`notary-page`**: Boolean flag to include a notary public acknowledgment
|
||||
page. Defaults to false.
|
||||
|
||||
### Text and Style Settings
|
||||
|
||||
- **`font`**: The typeface to use for the letter. Defaults to "Libertinus Serif".
|
||||
- **`size`**: Font size. Defaults to 11pt.
|
||||
- **`weight`**: Font weight. Defaults to "light".
|
||||
- **`strong-delta`**: Additional weight for bold text. Defaults to 300.
|
||||
- **`lang`**: Language for the document. Defaults to "en".
|
||||
|
||||
### Page Settings
|
||||
|
||||
- **`paper`**: Paper size for the document. Defaults to "us-letter".
|
||||
- **`margin`**: Margin size around the edges of the page. Defaults to "1in".
|
||||
|
||||
## License
|
||||
|
||||
This work is licensed under the MIT License.
|
||||
@@ -0,0 +1,193 @@
|
||||
#let pro-letter(
|
||||
|
||||
// sender information - all fields are optional, only use what you need
|
||||
sender: (
|
||||
name: none,
|
||||
company: none,
|
||||
street: none,
|
||||
city: none,
|
||||
state: none,
|
||||
zip: none,
|
||||
phone: none,
|
||||
email: none,
|
||||
),
|
||||
|
||||
// recipient information - all fields are optional, only use what you need
|
||||
recipient: (
|
||||
name: none,
|
||||
company: none,
|
||||
attention: none,
|
||||
street: none,
|
||||
city: none,
|
||||
state: none,
|
||||
zip: none,
|
||||
phone: none,
|
||||
email: none,
|
||||
),
|
||||
|
||||
// date of letter (optional)
|
||||
date: none,
|
||||
|
||||
// subject line of letter (optional)
|
||||
subject: none,
|
||||
|
||||
// salutation line (optional)
|
||||
salutation: "To whom it may concern,",
|
||||
|
||||
// closing line (required)
|
||||
closing: "Sincerely,",
|
||||
|
||||
// signer line (required)
|
||||
signer: none,
|
||||
|
||||
// attachments line at bottom of letter (optional)
|
||||
attachments: none,
|
||||
|
||||
// set to true if you want a notary public acknowledgement page
|
||||
notary-page: false,
|
||||
|
||||
// text settings
|
||||
font: "Libertinus Serif",
|
||||
size: 11pt,
|
||||
weight: "light",
|
||||
strong-delta: 300,
|
||||
lang: "en",
|
||||
|
||||
// page settings
|
||||
paper: "us-letter",
|
||||
margin: 1in,
|
||||
|
||||
// and finally the content
|
||||
body) = {
|
||||
|
||||
// --------------------------------
|
||||
// | Setup layout, style, options |
|
||||
// --------------------------------
|
||||
|
||||
set page(
|
||||
paper: paper,
|
||||
margin: margin,
|
||||
footer: align(right, context(counter(page).display("1 of 1", both: true))),
|
||||
)
|
||||
|
||||
set par(
|
||||
justify: true,
|
||||
)
|
||||
|
||||
set text(
|
||||
font: font,
|
||||
size: size,
|
||||
weight: weight,
|
||||
fallback: false,
|
||||
alternates: false,
|
||||
lang: lang,
|
||||
)
|
||||
|
||||
set strong(
|
||||
delta: strong-delta,
|
||||
)
|
||||
|
||||
// --------------------
|
||||
// | Helper functions |
|
||||
// --------------------
|
||||
|
||||
// Helper for our space between elements
|
||||
let vspace = { v(0.5em) }
|
||||
|
||||
// Helper for baseline underlines
|
||||
let blul(length) = box(line(length: length, stroke: 0.5pt))
|
||||
|
||||
// Helper to make sure address has all the fields we'll reference
|
||||
let normlize-address(address) = {
|
||||
(
|
||||
name: address.at("name", default: none),
|
||||
company: address.at("company", default: none),
|
||||
attention: address.at("attention", default: none),
|
||||
street: address.at("street", default: none),
|
||||
city: address.at("city", default: none),
|
||||
state: address.at("state", default: none),
|
||||
zip: address.at("zip", default: none),
|
||||
phone: address.at("phone", default: none),
|
||||
email: address.at("email", default: none),
|
||||
)
|
||||
}
|
||||
|
||||
// A function to render an address block.
|
||||
let show-address(address: (:)) = {
|
||||
// Extract parameters with default none values to handle missing elements.
|
||||
let a = normlize-address(address)
|
||||
|
||||
// Render the address, line by line, only including non-none elements.
|
||||
if a.name != none { a.name + "\n" }
|
||||
if a.company != none { a.company + "\n" }
|
||||
if a.attention != none { "a.attention: " + a.attention + "\n" }
|
||||
if a.street != none { a.street + "\n" }
|
||||
if a.city != none and a.state != none and a.zip != none {
|
||||
a.city + ", " + a.state + " " + a.zip + "\n"
|
||||
} else if a.city != none and a.state != none {
|
||||
a.city + ", " + a.state + "\n"
|
||||
} else if a.city != none and a.zip != none {
|
||||
a.city + " " + a.zip + "\n"
|
||||
} else if a.city != none {
|
||||
a.city + "\n"
|
||||
} else if a.state != none {
|
||||
a.state + "\n"
|
||||
} else if a.zip != none {
|
||||
a.zip + "\n"
|
||||
}
|
||||
if a.phone != none or a.email !=none { v(-0.4em)}
|
||||
if a.phone != none { "phone: " + link("tel:"+a.phone, a.phone) + "\n" }
|
||||
if a.email != none { "email: " + link("mailto:" + a.email, a.email) + "\n" }
|
||||
vspace
|
||||
}
|
||||
|
||||
// -----------------
|
||||
// | Letter output |
|
||||
// -----------------
|
||||
|
||||
// Top matter
|
||||
show-address(address: sender)
|
||||
if date != none { [#date #vspace] }
|
||||
show-address(address: recipient)
|
||||
if subject != none { [Subject: *#subject* #vspace] }
|
||||
|
||||
// Main body
|
||||
if salutation != none { [#salutation #vspace] }
|
||||
[#body #vspace]
|
||||
[#closing #v(0.6in) #blul(3in) \ #signer]
|
||||
|
||||
// Bottom matter
|
||||
if attachments != none { [#v(1fr) Attached: #attachments] }
|
||||
|
||||
// --------------------------
|
||||
// | Notary acknowledgement |
|
||||
// --------------------------
|
||||
|
||||
if notary-page {
|
||||
par(
|
||||
leading: 2.5em,
|
||||
[
|
||||
#set text(hyphenate: false)
|
||||
#pagebreak(weak: true)
|
||||
|
||||
#align(center, underline(strong(text(size: 1.5em, [Acknowledgement])))) \
|
||||
|
||||
State of #blul(1.1in) ) \
|
||||
#h(1.15in) § \
|
||||
County of #blul(1.1in) ) \ \
|
||||
|
||||
On #box[this #blul(0.5in) day] #box[of #blul(0.9in)], in the #box[year 20#blul(0.3in)],
|
||||
before me, #blul(1.45in) a notary public, personally appeared
|
||||
#blul(2.45in), proved on the basis of satisfactory evidence to be the
|
||||
person(s) whose name(s) #box[(is/are)] subscribed to this instrument, and
|
||||
acknowledged #box[(he/she/they)] executed the same. \ \
|
||||
|
||||
Witness my hand and official seal. \ \ \ \
|
||||
|
||||
#blul(2.35in) \ #v(-0.5em) _(notary signature)_ \
|
||||
|
||||
#h(5in) _(seal)_
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#import "@preview/pro-letter:0.1.1": pro-letter
|
||||
|
||||
#show: pro-letter.with(
|
||||
sender: (
|
||||
name: "Alexandra Bloom",
|
||||
street: "123 Blueberry Lane",
|
||||
city: "Wonderland",
|
||||
state: "NA",
|
||||
zip: "56789",
|
||||
phone: "+1-555-987-6543",
|
||||
email: "alex@bloomworld.net",
|
||||
),
|
||||
|
||||
recipient: (
|
||||
company: "Fantasy Finance Faucets",
|
||||
attention: "Treasury Team",
|
||||
street: "456 Dreamscape Ave",
|
||||
city: "Fabletown",
|
||||
state: "IM",
|
||||
zip: "12345",
|
||||
),
|
||||
|
||||
date: "January 15, 2025",
|
||||
|
||||
subject: "Account Closure Request",
|
||||
|
||||
signer: "Alexandra Bloom",
|
||||
|
||||
attachments: "Fae Council Closure Order.",
|
||||
|
||||
notary-page: true,
|
||||
)
|
||||
|
||||
I am writing to formally request the closure of the enchanted vault at Fantasy
|
||||
Finance Faucets held in my name, Alexandra Bloom.
|
||||
|
||||
Attached is the official Fae Council Closure Order for your verification and
|
||||
records.
|
||||
|
||||
The account is identified by the vault number: *12345FAE*.
|
||||
|
||||
As the rightful owner, I _authorize the closure of the aforementioned vault_ and
|
||||
_request that all enchanted funds be redirected to the Fae Council Reserve_.
|
||||
Please find the necessary details for the transfer enclosed.
|
||||
|
||||
Thank you for your prompt attention to this magical matter.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 313 KiB |
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "pro-letter"
|
||||
version = "0.1.1"
|
||||
entrypoint = "lib.typ"
|
||||
authors = ["Stephen Waits <steve@waits.net>"]
|
||||
license = "MIT"
|
||||
description = "A formal business letter template."
|
||||
categories = ["office"]
|
||||
disciplines = ["business", "communication"]
|
||||
keywords = ["professional", "business", "letter", "correspondence"]
|
||||
repository = "https://github.com/swaits/typst-collection"
|
||||
|
||||
[template]
|
||||
path = "template"
|
||||
entrypoint = "main.typ"
|
||||
thumbnail = "thumbnail.png"
|
||||
Reference in new issue
Block a user