SILE Typesetter Documentation

repository·master·Indexed 23 days ago

https://github.com/sile-typesetter/sile

SILE (Simon’s Improved Layout Engine) is a modern typesetting and layout engine designed for high-quality printed documents. It combines TeX's algorithmic strengths with the flexibility of graphical systems like InDesign and is extensible via Lua. Key capabilities include complex frame-based layouts, grid layouts, direct XML-to-PDF processing, and support for Citation Style Language (CSL).

Tokens
4.6K
Snippets
7
Records
30
Agent score
83%

What's inside SILE

  1. What is SILE?

    master
    SILE is a typesetting system designed to produce high-quality printed documents. While it borrows some concepts and algorithms from TeX, it is a ground-up implementation built with modern technologies. It functions more like a graphical layout system (similar to Adobe InDesign) than a traditional TeX derivative.
  2. How to support a language in SILE

    master

    To provide support for a new language in SILE, you must implement a combination of the following components:

    1. A base module: This is a required component for any language support.
    2. Hyphenation patterns module: Provides rules for the Knuth-Liang hyphenation algorithm.
    3. Localization strings: Provides translations for strings output in documents via a messages.ftl file for each locale.
  3. Key capabilities of SILE

    master

    SILE provides several layout features that distinguish it from TeX-based systems:

    • Complex Layouts: Use frames to produce sophisticated document layouts.
    • Extensibility: The system can be extended using the Lua programming language.
    • XML Processing: Directly process XML to PDF without requiring XSL stylesheets.
    • Grid Layouts: Typeset text on a defined grid.
  4. Understand the source of CSL locale files in SILE

    master

    SILE includes a default set of locale files for Citation Style Language (CSL) styles to facilitate testing and default behavior. These files are sourced from the official Citation Style Language project.

    Note that because these are provided for convenience within the SILE repository, they may not always be the most recent versions available from the upstream CSL project.

  5. Run SILE using Docker

    master

    Docker images are available on Docker Hub as siletypesetter/sile. You can use the latest tag or specific version tags (e.g., v0.10.0).

    To use SILE effectively in Docker, you must mount your project directory as a volume so SILE can access source files and write output.

    Accessing System Fonts: By default, the container does not have access to your host's fonts. To fix this, mount your host's font directory to /fonts inside the container.

    # Create an alias for easier usage (mounts current dir to /data)
    $ alias sile='docker run -it --volume "$(pwd):/data" siletypesetter/sile:latest'
    $ sile input.sil
    
    # Run with host fonts mounted to /fonts
    $ docker run -it --volume "/usr/share/fonts:/fonts" --volume "$(pwd):/data" siletypesetter/sile:latest
  6. Install SILE on macOS

    master

    You can install SILE on macOS using Homebrew. You can choose between the stable release or the latest development version from the git HEAD.

    Note: The Homebrew package does not automatically install the default font (Gentium Plus). It is recommended to install it via the Homebrew Fonts caskroom.

  7. Build SILE from source

    master

    Building from source requires a Rust toolchain and Lua sources. SILE relies on HarfBuzz (min version 2.7.4), fontconfig, and ICU libraries.

    Key Steps:

    1. Ensure dependencies (HarfBuzz, fontconfig, ICU, OpenSSL development headers) are installed.
    2. If using a Git clone, run ./bootstrap.sh first.
    3. Run ./configure and make.
    4. Use sudo make install to install to the system.

    Developer Mode: If you are developing SILE, use the --enable-developer-mode flag during configuration. This sets the 'installed data' directory to your source location, allowing the binary to run directly from the source without installation, and enables testing targets like make regressions.

  8. Use SILE in GitHub Actions CI workflows

    master

    You can automate document rendering in a CI environment using GitHub Actions. The easiest way is to use the sile-typesetter/sile@v0 action. This action assumes your repository contains a source file (e.g., my-document.sil) and will output a PDF (e.g., my-document.pdf).

    name: SILE
    on: [ push, pull_request ]
    jobs:
      sile:
        runs-on: ubuntu-latest
        steps:
          - name: Checkout
            uses: actions/checkout@v3
          - name: Render document with SILE
            uses: sile-typesetter/sile@v0
            with:
              args: my-document.sil
  9. Install SILE on Linux

    master

    SILE is available in the official repositories for several Linux distributions:

    • Arch Linux: Uses the official package. If using LuaRocks via pacman, use lua51-* variants to match LuaJIT.
    • Fedora: Available in official repositories. You may need to install fonts separately.
    • OpenSUSE: Available via zypper.
    • NixOS: Available in both stable and unstable channels.
    • Ubuntu: Available via a PPA.
    • Void Linux: Available in the default package manager.
    # Arch Linux
    $ pacman -S sile
    
    # Fedora
    $ dnf install sile
    # To install default fonts on Fedora:
    $ dnf install sil-gentium-plus-fonts alerque-libertinus-fonts hack-fonts
    
    # OpenSUSE
    $ zypper install sile
    
    # Ubuntu
    $ add-apt-repository ppa:sile-typesetter/sile
    $ apt-get update
    $ apt-get install sile
  10. Install third-party SILE packages via luarocks

    master

    SILE plugins are managed via luarocks. To ensure compatibility, you must install packages for the specific Lua version that SILE uses. You can query SILE's Lua version using sile -q <<< SILE.lua_version.

    Installation Locations

    1. System-wide (Default): Uses the --global option (usually requires root).
    2. Local Directory: Use --tree lua_modules to install into a lua_modules directory in your current folder. SILE automatically detects plugins in this directory if it is adjacent to your document.
    3. User Profile: Use the --local option to install to your user profile.

    Configuring Plugin Paths

    If you install plugins to a custom directory (other than lua_modules), you must tell SILE where to find them:

    • Environment Variable: Run eval $(luarocks --lua-version $(sile -q <<< SILE.lua_version) path --local) (or use your specific --tree path) to update your shell environment.
    • CLI Argument: Pass the --luarocks-tree <path> argument directly to the sile command.
  11. Run SILE using Nix

    master

    Nix is a viable alternative for running SILE on most platforms (Linux, BSD, macOS, and Windows via WSL). The unstable channel is recommended for the latest releases.

    You can launch a shell with SILE available or run it directly as a single command. Since the source is a Nix Flake, you can also run specific tagged versions or branches directly.

    # Launch a new shell with SILE available
    $ nix shell nixpkgs/nixpkgs-unstable#sile
    $ sile <arguments>
    
    # Run SILE directly as a single command
    $ nix run nixpkgs/nixpkgs-unstable#sile -- <arguments>
    
    # Explicitly run a tagged version
    $ nix run github:sile-typesetter/sile/v0.14.13 -- <arguments>
    
    # Run the master branch HEAD
    $ nix run github:sile-typesetter/sile -- <sile arguments>
    
    # Run the develop branch HEAD
    $ nix run github:sile-typesetter/sile/develop -- <sile arguments>