diatypst

repository·main·Indexed 41 days ago

https://github.com/skriptum/diatypst

A tool for creating well-styled presentation slides using the Typst typesetting system. It features automated slide generation based on heading levels, adjustable themes, dot counters, and customizable layouts. It is available as a Typst package (v0.9.3) and as a Quarto extension via the diaquarto-typst format.

Tokens
5.5K
Snippets
24
Records
30
Agent score
50%

What's inside diatypst

  1. Overview of diatypst features

    main

    Diatypst is a Typst-based package designed for creating presentation slides easily. It provides several built-in features to streamline slide creation:

    • Heading-based structure: Uses standard Typst headings as delimiters for slides and sections.
    • Sensible styling: Comes with pre-configured layouts and styles.
    • Slide numbering: Includes a dot counter in the upper right corner, similar to LaTeX Beamer.
    • Theming: Supports adjustable color themes.
    • Automatic formatting: Includes default show rules for terms, code, lists, and other elements that automatically adapt to the selected color theme.
  2. Understand diatypst default styling

    main
    diatypst provides default styling for common Typst elements. All styled elements automatically follow the theme color established during the diatypst call (which defaults to a dark blue). This ensures visual consistency across terms, code blocks, quotes, tables, lists, and references.
  3. Use a black background for presentations

    main

    To adjust a presentation for dimmed environments, use the bg-color option within the slides.with() function. When changing the background color, you should also update the title-color (for headings and other elements) and the global text color using #set text(fill: ...) to ensure readability. You can use any valid Typst color, including RGB codes.

    #show: slides.with(
      title-color: white, // color for elements like headings 
      bg-color: black,    // background color
    )
    
    #set text(fill: white) // text color
  4. Use Diatypst offline

    main
    If you are using Typst offline (for example, via the VS Code extension), the Typst compiler will automatically download the required version of diatypst specified in your #import statement. Simply initialize your document using the standard #import and #show: slides.with(...) pattern.
  5. Initialize Diatypst in a Typst project

    main

    To use diatypst in an existing or manual Typst project, import the package and use the slides function with a show rule. The title parameter is required.

    #import "@preview/diatypst:0.9.3": *
    #show: slides.with(
      title: "Diatypst", // Required
      subtitle: "easy slides in typst",
      date: "01.07.2024",
      authors: ("John Doe"),
    )
    #import "@preview/diatypst:0.9.3": *
    #show: slides.with(
      title: "Diatypst", // Required
      subtitle: "easy slides in typst",
      date: "01.07.2024",
      authors: ("John Doe"),
    )
  6. Create a custom title slide in diatypst

    main

    By default, diatypst generates a standard title slide. To create a custom first slide (e.g., to include logos or specific layouts), you must:

    1. Disable the default title slide by setting first-slide: false in the slides.with function.
    2. Define your custom slide content before calling #show: slides.with.
    3. Manually configure the #set page properties to match your desired aspect ratio and dimensions, as the custom slide will not automatically inherit the presentation's layout settings.

    Supported heights for the page are 9cm, 10.5cm, or 12cm. The width should be calculated based on your chosen ratio (e.g., 4/3 * height).

    #import "@preview/diatypst:0.9.3": *
    
    #set page(
      footer: none, header: none, margin: 0cm,
      height: 10.5cm, // height is either 9cm, 10.5cm or 12cm
      width: 4/3*10.5cm, // width is your height * your ratio
    )
    
    // --- Your Custom Slide Content Goes Here ---
    #block(width: 100%, height: 100%, fill: blue)[Custom Slide]
    
    // --- Call the diatypst function ---
    #show: slides.with(
      first-slide: false,
      // ... other options
    )
  7. Use diatypst with Quarto

    main

    Diatypst is available as a Quarto extension.

    1. Install the extension using the CLI:
      quarto add skriptum/diatypst/diaquarto
    2. Create a .qmd file and configure the diaquarto-typst format in the YAML frontmatter.

    Note: Only a subset of the standard Typst options are available in the Quarto version.

    title: "Untitled"
    ...
    format:
      diaquarto-typst:
        layout: medium # small, medium, large
        ratio: 16/9 # any ratio possible
        title-color: "013220" # Any Hex code for the title color (without #)
  8. Link to specific slides using Typst labels

    main

    In diatypst, you can create hyperlinks to specific slides by combining Typst labels with the #ref() function or the @label shorthand.

    1. Assign a label to a target: Add a label to a heading using the <label_name> syntax (e.g., == Heading <label1>).
    2. Create the link:
      • Use #ref(<label_name>, supplement: "text") to create a link with custom descriptive text.
      • Use the @label_name syntax for a standard Typst reference link.
    // 1. Define the target slides with labels
    == Heading <label1>
    #lorem(100)
    
    == Another Heading <label2>
    #lorem(100)
    
    // 2. Link to them
    You can go to the #ref(<label1>, supplement: "first slide") or maybe to @label2 if that suits you better.
  9. Structure slides using headings and pagebreaks

    main

    Diatypst uses standard Typst heading levels to manage the presentation structure:

    • Level-one headings (= Heading): Create new sections.
    • Level-two headings (== Heading): Create new slides.
    • Manual breaks: Use the #pagebreak() command to force a new slide.

    Example:

    = First Section
    
    == First Slide
    
    #lorem(20)
    = First Section
    
    == First Slide
    
    #lorem(20)
  10. Initialize a diatypst presentation

    main

    To use diatypst in a Typst document, import the package and initialize the presentation using the slides.with function. The title parameter is required. You can define the presentation structure using headings:

    • Level-one headings (=) create new sections.
    • Level-two headings (==) create new slides.
    • Alternatively, use #pagebreak() to manually create a new slide.
    #import "@preview/diatypst:0.9.3": *
    #show: slides.with(
      title: "Diatypst", // Required
      subtitle: "easy slides in typst",
      date: "01.07.2024",
      authors: ("John Doe"),
    )
    
    = First Section
    
    == First Slide
    
    #lorem(20)