Skip to content
AsmilexPublic
forked from talal/ilm

About

A versatile, clean and minimal template for non-fiction writing. Ideal for class notes, reports, and books.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Ilm prima

'Ilm prima is a fork of talal/ilm that tunes some features to my liking; namely typography, colors, and so on.

Installation

I haven't published the package to the Universe, so the installation has to be local.

Clone the repository wherever you keep your code, then symlink it into Typst's local package namespace. Typst expects the layout {data-dir}/typst/packages/{namespace}/{name}/{version}, and the version directory must match the version field in typst.toml (currently 1.0.0):

git clone git@github.com:Asmilex/ilm.git
cd ilm

# macOS
mkdir -p "$HOME/Library/Application Support/typst/packages/local/ilm-prima"
ln -s "$PWD" "$HOME/Library/Application Support/typst/packages/local/ilm-prima/1.0.0"

# Linux
mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/typst/packages/local/ilm-prima"
ln -s "$PWD" "${XDG_DATA_HOME:-$HOME/.local/share}/typst/packages/local/ilm-prima/1.0.0"

Run typst info if you are unsure about the location: it prints the Package path that your installation actually uses, which differs for Snap installs and when TYPST_PACKAGE_PATH is set.

A symlink (rather than a copy) means edits to lib.typ take effect immediately in every document that imports the package. The flip side: after bumping version in typst.toml, the symlink has to be recreated under the new version number, and every document has to update its import.

To remove the installation, delete the symlink:

rm "$HOME/Library/Application Support/typst/packages/local/ilm-prima/1.0.0"

Usage

With the package installed, start a new project from the template:

typst init @local/ilm-prima

Typst creates a new directory with all the files needed to get you started, including a sample call to the ilm function in a show rule.

To convert an existing project instead, add a show rule like this at the top of your file:

#import "@local/ilm-prima:1.0.0": *

#set text(lang: "en")

#show: ilm.with(
  title: [Your Title],
  authors: "Max Mustermann",
  abstract: [#lorem(30)],
  bibliography: bibliography("refs.bib"),
  figure-index: (enabled: true),
  table-index: (enabled: true),
  listing-index: (enabled: true)
)

// Your content goes here.

Without installing it

If a document has to keep building on machines where the package is not installed --- a thesis repository, a shared paper --- vendor it as a git submodule and import it by path instead. This pins an exact commit and needs no setup beyond git submodule update --init:

git submodule add git@github.com:Asmilex/ilm.git vendor/ilm-prima
#import "/vendor/ilm-prima/lib.typ": *

This template uses Crimson Pro for body text and the Iosevka font for raw text (inline code and code blocks). Both fonts must be installed on your computer. If they are not — as will be the case for the Typst Web App — the template falls back to "Libertinus Serif" and "DejaVu Sans Mono" respectively, which are available on the Typst Web App. Use the body-text and raw-text options to pick different families, sizes and weights.

Configuration

The template exports the ilm function with several named arguments (read: options). This function also accepts a single, positional argument for the body.

The language setting for text (lang parameter of text function) should be defined before the ilm function so that headings such as table of contents and bibliography will be defined as per the text language. See example above.

Options

The list below shows a brief description for each option. For a detailed explanation of these options, compile specimens/debug.typ, which exercises every one of them.

  • cover-page
    type: string, content, or none
    default: "use-ilm-default"
    description: Cover page customization. Set to "use-ilm-default" for the default cover page, none to skip the cover page, or provide custom content to create your own cover page.

  • title
    type: content
    default: Your Title
    description: The title for your work.

  • authors
    type: string or array
    default: none
    description: The author(s) of your work. Can be a string for a single author or an array of strings for multiple authors. Multiple authors will be displayed on separate lines with font size automatically scaled.

  • paper-size
    type: string
    default: a4
    description: Specify a paper size string to change the page size.

  • date
    type: datetime or none
    default: datetime.today()
    description: The date that will be displayed on the cover page. Set to none to disable date.

  • date-format
    type: string
    default: [month repr:long] [day padding:zero], [year repr:full]
    description: The format for the date that will be displayed on the cover page. By default, the date will be displayed as MMMM DD, YYYY.

  • abstract
    type: content or none
    default: none
    description: A brief summary/description of your work. This is shown on the cover page. Set to none to disable.

  • preface
    type: content
    default: none
    description: The preface for your work. The preface content is shown on its own separate page after the cover.

  • chapter-pagebreak
    type: bool
    default: true
    description: Setting this to false will prevent chapters from starting on a new page.

  • external-link-circle
    type: bool
    default: false
    description: Setting this to true will show a small maroon circle next to external links.

  • body-text
    type: dictionary, string or array
    default: (font: ("Crimson Pro", "Libertinus Serif"), size: 12pt, weight: "regular")
    description: Customize body text styling. Provide a dictionary with any of the font, size and weight keys — the keys you omit keep their default value. A string or an array is also accepted and is treated as the font family (or list of families, in order of priority).

  • link-underline
    type: bool
    default: true
    description: Setting this to false will disable the underline that is drawn beneath links.

  • footer
    type: string or none
    default: "page-number-alternate-with-chapter"
    description: Footer style for page numbering. Set to none to disable footer entirely. Available styles: "page-number-alternate-with-chapter" (alternating sides with chapter name), "page-number-left-with-chapter", "page-number-right-with-chapter", "page-number-center", "page-number-left", "page-number-right".

  • raw-text
    type: string or dictionary
    default: (font: ("Iosevka", "DejaVu Sans Mono"), size: 9pt)
    description: Customize raw text (code) styling. Set to "use-typst-default" to use Typst's default formatting, or provide a dictionary with any of the font, size and weight keys — the keys you omit keep their default value.

  • table-of-contents
    type: content
    default: outline()
    description: The result of a call to the outline function or none. Setting this to none will disable the table of contents.

  • appendix
    type: dictionary
    default: (enabled: false, title: "Appendix", heading-numbering-format: "A.1.1.", body: none)
    description: Setting enabled to true and defining your content in body will display the appendix after the main body of your document and before the bibliography.

  • bibliography
    type: content
    default: none
    description: The result of a call to the bibliography function or none. Specifying this will configure numeric, IEEE-style citations.

  • figure-index
    type: dictionary
    default: (enabled: false, title: "Index of Figures")
    description: Setting this to true will display an index of image figures at the end of the document.

  • table-index
    type: dictionary
    default: (enabled: false, title: "Index of Tables")
    description: Setting this to true will display an index of table figures at the end of the document.

  • listing-index
    type: dictionary
    default: (enabled: false, title: "Index of Listings")
    description: Setting this to true will display an index of listing (code block) figures at the end of the document.

About

A versatile, clean and minimal template for non-fiction writing. Ideal for class notes, reports, and books.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages