harrellbm / Bookletic

Create beautiful booklets using Typst
Apache License 2.0
6 stars 2 forks source link

Bookletic :book:

Create beautiful booklets with ease.

The current version of this library (0.3.0) contains a single function to take in an array of content blocks and order them into a ready to print booklet, bulletin, etc. No need to fight with printer settings or document converters.

Example Output

Here is an example of the output generated by the sig function (short for a book's signature) with default parameters and some sample content:

Example1

Here is an example with some customization applied:

Example2

sig Function

The sig function is used to create a signature (booklet) layout from provided content. It takes various parameters to automatically configure the layout.

Parameters

Usage

To use the sig function, first set your desired page settings using the native page function. Then simply call the sig function with the desired parameters and provide the content to be laid out in the booklet:

#set page(flipped: true, paper: "us-letter")
#bookletic.sig(
  contents: [
    ["Page 1 content"],
    ["Page 2 content"],
    ["Page 3 content"],
    ["Page 4 content"],
  ],
)

This will create a signature layout with the provided content, using the default values for the other parameters.

You can customize the layout by passing different values for the various parameters. For example:

#set page(flipped: true, paper: "us-legal", margin: (top: 1in, bottom: 1in, left: 1in, right: 1in))
#bookletic.sig(
  page_margin_binding: 0.5in,
  page_border: none,
  draft: true,
  p-num-layout: (
    bookletic.num-layout(
      p-num-start: 1,
      p-num-alt-start: none,
      p-num-pattern: "~ 1 ~", 
      p-num-placment: bottom,
      p-num-align-horizontal: right,
      p-num-align-vertical: horizon,
      p-num-pad-left: -5pt,
      p-num-pad-horizontal: 0pt,
      p-num-size: 16pt,
      p-num-border: rgb("#ff4136"),
      p-num-halign-alternate: false,
    ),
  ),
  pad_content: 10pt,
  contents: (
    ["Page 1 content"],
    ["Page 2 content"],
    ["Page 3 content"],
    ["Page 4 content"],
  ),
)

This will create an unordered draft signature layout with US Legal paper size, larger margins, no page borders, page numbers at the bottom right corner with a red border, and more padding around the content.

Notes

Collaboration

I would love to see this package eventually turn into a community effort. So any interest in collaboration is very welcome! You can find the github repository for this library here: Bookletic Repo. Feel free to file an issue, pull request, or start a discussion.

Changlog

0.3.0

0.2.0

0.1.0

Initial Commit