Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5964bc082a
|
||
|
|
41e1c184e8
|
No files matched your search
@@ -11,8 +11,6 @@ links below to their main page.
|
||||
- [**codly-languages**](https://typst.app/universe/package/codly-languages): A
|
||||
set of language configurations for use with
|
||||
[codly](https://typst.app/universe/package/codly).
|
||||
- [easy-typography](https://typst.app/universe/package/easy-typography): Sets up
|
||||
sensible typography defaults.
|
||||
- [**glossy**](https://typst.app/universe/package/glossy): A very simple
|
||||
glossary system with easily customizable output.
|
||||
- [**rfc-vibe**](https://typst.app/universe/package/rfc-vibe): Bring RFC language
|
||||
|
||||
@@ -10,7 +10,7 @@ Pretty simple. Import `codly`. Initialize it. Import `codly-languages`.
|
||||
Configure `codly` with the languages. Like this:
|
||||
|
||||
```typst
|
||||
#import "@preview/codly:1.1.0": *
|
||||
#import "@preview/codly:1.1.1": *
|
||||
#show: codly-init
|
||||
|
||||
#import "@preview/codly-languages:0.1.3": *
|
||||
@@ -50,7 +50,6 @@ The following languages are still missing. All contributions welcome.
|
||||
- Jinja2
|
||||
- Jsonnet
|
||||
- Lean
|
||||
- Lisp
|
||||
- LiveScript
|
||||
- Makefile
|
||||
- MediaWiki
|
||||
@@ -93,6 +92,11 @@ The following languages are still missing. All contributions welcome.
|
||||
The `typst-small.png` icon included in this package came from the MIT-licensed
|
||||
[codly](https://github.com/Dherse/codly) project.
|
||||
|
||||
The `lisp.svg` icon comes [from
|
||||
Wikipedia](https://commons.wikimedia.org/wiki/File:Lisp_logo.svg), attribution:
|
||||
Jooja, CC BY-SA 4.0 <https://creativecommons.org/licenses/by-sa/4.0>, via
|
||||
Wikimedia Commons.
|
||||
|
||||
All other icons included here came from the MIT-licensed
|
||||
[devicon](https://github.com/devicons/devicon/) project.
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="256" cy="256" r="235" fill="#fff"/>
|
||||
<path stroke="#000" stroke-width="5" d="m255.56 20.008c-62.374 0.1169-122.17 24.922-166.3 68.992-92.236 92.091-92.353 241.52-0.2617 333.75 92.09 92.236 241.52 92.353 333.75 0.262 92.236-92.091 92.353-241.52 0.262-333.75-44.377-44.447-104.64-69.371-167.45-69.254zm2.281 1.0059c59.934 0.4846 119.39 23.809 164.46 68.953 91.701 91.845 91.585 240.64-0.259 332.34-45.922 45.851-120.32 45.793-166.17-0.129-45.851-45.922-45.793-120.32 0.129-166.17 46.412-46.339 46.471-121.53 0.13-167.94-37.084-37.141-94.457-46.553-140.66-21.658 42.416-31.541 92.711-45.798 142.37-45.396zm-190.84 130.26h40c9.943 42.147 25.204 79.418 40.75 116.43 15.9-41.326 33.203-81.249 55.25-116.43h40c-48.928 97.364-102.19 164.06-24 250h-40c-47.567-77.243-82.439-147.67-112-250z"/>
|
||||
<path d="m293 110.72c78.194 85.936 24.928 152.64-24 250h40c22.047-35.179 39.35-75.102 55.25-116.43 15.546 37.01 30.807 74.282 40.75 116.43h40c-29.561-102.33-64.433-172.76-112-250z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -4,7 +4,7 @@
|
||||
// To use:
|
||||
//
|
||||
// ```typst
|
||||
// #import "@preview/codly:1.1.0": *
|
||||
// #import "@preview/codly:1.1.1": *
|
||||
// #show: codly-init
|
||||
//
|
||||
// #import "codly-languages.typ": *
|
||||
@@ -80,6 +80,7 @@
|
||||
kt: (name: "Kotlin", color: rgb("#5e3cc2"), icon: __icon("kotlin.svg")),
|
||||
latex: (name: "LaTeX", color: rgb("#000000"), icon: __icon("latex.svg")),
|
||||
less: (name: "Less", color: rgb("#2a4d80"), icon: __icon("less.svg")),
|
||||
lisp: (name: "Lisp", color: rgb("#3FBF3F"), icon: __icon("lisp.svg")),
|
||||
lua: (name: "Lua", color: rgb("#000080"), icon: __icon("lua.svg")),
|
||||
markdown: (name: "Markdown", color: rgb("#000000"), icon: __icon("markdown.svg")),
|
||||
matlab: (name: "Matlab", color: rgb("#4499dd"), icon: __icon("matlab.svg")),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import "/lib.typ": *
|
||||
#import "@preview/codly:1.1.0": *
|
||||
#import "@preview/codly:1.1.1": *
|
||||
#show: codly-init
|
||||
#codly(languages: codly-languages)
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 75 KiB |
@@ -42,6 +42,7 @@
|
||||
"kotlin",
|
||||
"latex",
|
||||
"less",
|
||||
"lisp",
|
||||
"lua",
|
||||
"markdown",
|
||||
"matlab",
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
tests/**/out/
|
||||
tests/**/diff/
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 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.
|
||||
@@ -1,65 +0,0 @@
|
||||
# Easy Typography for Typst
|
||||
|
||||
A Typst package that simplifies professional typography by providing sensible
|
||||
defaults and easy customization options. Focus on your content while ensuring
|
||||
beautiful, readable documents.
|
||||
|
||||
## Features
|
||||
|
||||
- 🎨 Precise heading scale with clear hierarchy
|
||||
- 📏 Optimal line height and paragraph spacing
|
||||
- 📖 Professional text justification and hyphenation
|
||||
- ⚖️ Balanced vertical rhythm throughout
|
||||
- ⚡ Simple configuration with reasonable defaults
|
||||
|
||||
## Usage
|
||||
|
||||
Basic usage with default settings:
|
||||
|
||||
```typst
|
||||
#import "@preview/easy-typography:0.1.0": *
|
||||
#show: easy-typography
|
||||
|
||||
= Your Document Title
|
||||
Your content here...
|
||||
```
|
||||
|
||||
Customized usage with specific fonts:
|
||||
|
||||
```typst
|
||||
#show: easy-typography.with(
|
||||
fonts: (
|
||||
heading: "Source Sans Pro",
|
||||
body: "Source Serif Pro"
|
||||
),
|
||||
body-size: 11pt,
|
||||
paper: "a4",
|
||||
margin: 2cm
|
||||
)
|
||||
```
|
||||
|
||||
## Configuration Options
|
||||
|
||||
- `body-size`: Base size for body text (default: 10pt)
|
||||
- `fonts`: Dictionary specifying heading and body fonts
|
||||
- `heading`: Font for headings (default: "Libertinus Sans")
|
||||
- `body`: Font for body text (default: "Libertinus Serif")
|
||||
- `paper`: Paper size setting (optional)
|
||||
- `margin`: Page margin setting (optional)
|
||||
|
||||
## Example Output
|
||||
|
||||
The package automatically handles:
|
||||
|
||||
- Heading sizes with natural visual hierarchy (H1-H5)
|
||||
- Optimal spacing between elements
|
||||
- Professional text justification
|
||||
- Smart hyphenation
|
||||
- Consistent vertical rhythm
|
||||
|
||||
See the [example output](thumbnail.png) for more information and a complete
|
||||
example.
|
||||
|
||||
## License
|
||||
|
||||
MIT License - See [LICENSE](LICENSE) for details.
|
||||
@@ -1 +0,0 @@
|
||||
#import "src/main.typ": easy-typography
|
||||
@@ -1,29 +0,0 @@
|
||||
// Constants
|
||||
|
||||
// space above H1
|
||||
#let heading-above-max = 1.25em
|
||||
|
||||
// space above H5
|
||||
#let heading-above-min = 0.80em
|
||||
|
||||
// space below H1
|
||||
#let heading-below-max = 0.65em
|
||||
|
||||
// space below H5
|
||||
#let heading-below-min = 0.55em
|
||||
|
||||
// font size for H1
|
||||
#let heading-size-max = 1.10em
|
||||
|
||||
// font size for H5
|
||||
#let heading-size-min = 1.00em
|
||||
|
||||
// default text weight -- light is best for reading, and printers are fine with
|
||||
// it these days
|
||||
#let body-weight = "light"
|
||||
|
||||
// line spacing -- tight; efficient but still readable with good fonts
|
||||
#let line-spacing = 1.30
|
||||
|
||||
// paragraph spacing -- defaults to a double-space
|
||||
#let paragraph-spacing = 1.70
|
||||
@@ -1,102 +0,0 @@
|
||||
#import "constants.typ": *
|
||||
|
||||
/// The main function for easy typography setup.
|
||||
///
|
||||
/// - body-size (): The size of body text (default 10pt).
|
||||
/// - fonts (): A dictionary specifying heading/body fonts.
|
||||
/// - paper (str): The paper size to use (none to skip).
|
||||
/// - margin (): Margin for the page (none to skip).
|
||||
/// -> content
|
||||
#let easy-typography(
|
||||
body-size: 10pt,
|
||||
fonts: (heading: "Libertinus Sans", body: "Libertinus Serif"),
|
||||
paper: none,
|
||||
margin: none,
|
||||
body
|
||||
) = {
|
||||
// Optional page setup
|
||||
if paper != none {
|
||||
set page(paper: paper)
|
||||
}
|
||||
if margin != none {
|
||||
set page(margin: margin)
|
||||
}
|
||||
|
||||
// Paragraphs
|
||||
set par(
|
||||
leading: line-spacing * 0.5em,
|
||||
spacing: paragraph-spacing * 0.5em,
|
||||
justify: true,
|
||||
linebreaks: "optimized",
|
||||
)
|
||||
|
||||
// Body text
|
||||
set text(
|
||||
font: fonts.body,
|
||||
fallback: false,
|
||||
style: "normal",
|
||||
weight: body-weight,
|
||||
stretch: 100%,
|
||||
size: body-size,
|
||||
tracking: 0pt,
|
||||
spacing: 100% + 0pt,
|
||||
baseline: 0pt,
|
||||
overhang: true,
|
||||
hyphenate: true,
|
||||
kerning: true,
|
||||
ligatures: true,
|
||||
number-width: "proportional",
|
||||
// number-type: "lining", // commented: intentionally left up to the font to choose
|
||||
)
|
||||
|
||||
show table: set text(number-width: "tabular")
|
||||
|
||||
/// Top-heavy easing function for heading sizes/spacing.
|
||||
///
|
||||
/// `sqrt(t)` gives biggest decrease at top, gentlest at bottom.
|
||||
///
|
||||
/// - max (length): Biggest size (H1)
|
||||
/// - min (length): Smallest size (H5)
|
||||
/// - level (length): From 1 to 5
|
||||
/// -> length
|
||||
let compute-size(max, min, level) = {
|
||||
if level <= 1 {
|
||||
max
|
||||
} else if level >= 5 {
|
||||
min
|
||||
} else {
|
||||
let t = (level - 1) / 4
|
||||
max - (max - min) * calc.sqrt(t)
|
||||
}
|
||||
}
|
||||
|
||||
// Heading weight logic
|
||||
let compute-weight(level) = {
|
||||
if level <= 1 {
|
||||
"bold"
|
||||
} else if level == 2 {
|
||||
"semibold"
|
||||
} else if level == 3 {
|
||||
"medium"
|
||||
} else {
|
||||
"regular"
|
||||
}
|
||||
}
|
||||
|
||||
// Show headings using computed size/spacing values
|
||||
show heading: it => block(
|
||||
breakable: false,
|
||||
sticky: true,
|
||||
above: compute-size(heading-above-max, heading-above-min, it.level),
|
||||
below: compute-size(heading-below-max, heading-below-min, it.level),
|
||||
text(
|
||||
font: fonts.heading,
|
||||
size: compute-size(heading-size-max, heading-size-min, it.level),
|
||||
weight: compute-weight(it.level),
|
||||
it
|
||||
)
|
||||
)
|
||||
|
||||
// Finally, render the body
|
||||
body
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 769 KiB |
@@ -1,125 +0,0 @@
|
||||
#import "/lib.typ": *
|
||||
|
||||
#import "@preview/codly:1.2.0": *
|
||||
#import "@preview/codly-languages:0.1.1": *
|
||||
#show: codly-init.with()
|
||||
#codly(languages: codly-languages)
|
||||
|
||||
#show: easy-typography.with(
|
||||
fonts: (heading: "Source Sans 3", body: "Source Serif 4"),
|
||||
)
|
||||
|
||||
= Introducing Easy Typography
|
||||
|
||||
#set heading(numbering: (..nums) => {
|
||||
numbering("1.1.", ..nums.pos().slice(1))
|
||||
})
|
||||
|
||||
The `easy-typography` package transforms complex typographic decisions into
|
||||
simple choices, letting you focus on your content while ensuring professional
|
||||
results. By adjusting the settings to match your specific needs, you can refine
|
||||
the aesthetic or adapt your layout for everything from casual reading to formal
|
||||
publication.
|
||||
|
||||
== Core Typography Features
|
||||
|
||||
The package manages:
|
||||
|
||||
#columns(2)[
|
||||
- Precise heading scale with a clear hierarchy
|
||||
- Optimal line height and paragraph spacing
|
||||
#colbreak()
|
||||
- Professional text justification and hyphenation
|
||||
- Balanced vertical rhythm throughout
|
||||
]
|
||||
|
||||
These features ensure that your document is both visually appealing and easy to
|
||||
read.
|
||||
|
||||
=== Type Formatting
|
||||
|
||||
This package automatically adjusts line spacing, paragraph spacing, and
|
||||
justification to maintain a clean layout. Headings are also carefully weighted
|
||||
to balance them against the body text, so you can focus on content rather than
|
||||
tweaking spacing and sizing. Standard formatting like *bold* and _italic_
|
||||
integrates seamlessly with `easy-typography`'s approach.
|
||||
|
||||
=== Heading Levels
|
||||
|
||||
The heading scale gracefully steps down, ensuring that each level remains
|
||||
distinct yet consistent. Behind the scenes, `easy-typography` calculates the
|
||||
ideal size for each heading, preserving a cohesive visual hierarchy as your
|
||||
document gets deeper. This approach supports manuals, academic papers, and any
|
||||
long-form text where structure matters. It also helps in shorter documents,
|
||||
guaranteeing a crisp layout with minimal effort.
|
||||
|
||||
== Why Typography Matters
|
||||
|
||||
Good typography isn't just about aesthetics. It's about effective communication.
|
||||
Well-designed text:
|
||||
|
||||
#columns(2)[
|
||||
- Improves reading comprehension
|
||||
- Reduces eye strain
|
||||
- Maintains reader engagement
|
||||
#colbreak()
|
||||
- Establishes visual hierarchy
|
||||
- Conveys professionalism
|
||||
]
|
||||
|
||||
Notice how this document's typography enhances readability. The justified text,
|
||||
proper hyphenation, and optimized line breaks create a clean, professional
|
||||
appearance. With each heading level, the user can quickly scan and digest
|
||||
important information.
|
||||
|
||||
== Example Usage and Output
|
||||
|
||||
#set heading(numbering: none)
|
||||
#show raw.where(block: true): set text(size: 7pt)
|
||||
|
||||
#grid(
|
||||
columns: (55%, auto),
|
||||
gutter: 1.0em,
|
||||
[
|
||||
// code
|
||||
```typst
|
||||
#import "@preview/easy-typography:0.1.0": *
|
||||
#show: easy-typography.with(
|
||||
fonts: (
|
||||
heading: "Source Sans Pro",
|
||||
body: "Source Serif Pro"
|
||||
),
|
||||
)
|
||||
|
||||
#lorem(6)
|
||||
= Level One
|
||||
#lorem(6)
|
||||
== Level Two
|
||||
#lorem(6)
|
||||
=== Level Three
|
||||
#lorem(6)
|
||||
==== Level Four
|
||||
#lorem(6)
|
||||
===== Level Five
|
||||
#lorem(6)
|
||||
```
|
||||
],
|
||||
box(
|
||||
stroke: 0.5pt + silver,
|
||||
inset: 0.5em,
|
||||
radius: 0.2em,
|
||||
[
|
||||
#lorem(6)
|
||||
= Level One
|
||||
#lorem(6)
|
||||
== Level Two
|
||||
#lorem(6)
|
||||
=== Level Three
|
||||
#lorem(6)
|
||||
==== Level Four
|
||||
#lorem(6)
|
||||
===== Level Five
|
||||
#lorem(6)
|
||||
]
|
||||
) // box
|
||||
)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 306 KiB |
@@ -1,10 +0,0 @@
|
||||
[package]
|
||||
name = "easy-typography"
|
||||
version = "0.1.0"
|
||||
entrypoint = "lib.typ"
|
||||
authors = ["Stephen Waits <steve@waits.net>"]
|
||||
license = "MIT"
|
||||
description = "Sets up sensible typography defaults."
|
||||
keywords = ["easy", "typography", "defaults"]
|
||||
repository = "https://github.com/swaits/typst-collection"
|
||||
exclude = ["thumbnail.png", "tests"]
|
||||
Reference in new issue
Block a user