### Typst Quickstart Example for Polylux Presentations Source: https://github.com/polylux-typ/polylux/blob/main/README.md This code snippet demonstrates the basic usage of the Polylux package in Typst to create presentation slides. It shows how to import the package, set page dimensions and text styles, and define multiple slides with varying content, including dynamic elements like uncover. This serves as a minimal example for getting started with Polylux presentations. ```typst #import "@preview/polylux:0.4.0": * // Make the paper dimensions fit for a presentation and the text larger #set page(paper: "presentation-16-9") #set text(size: 25pt, font: "Lato") // Use #slide to create a slide and style it using your favourite Typst functions #slide[ #set align(horizon) = Very minimalist slides A lazy author July 23, 2023 ] #slide[ == First slide Some static text on this slide. ] #slide[ == This slide changes! You can always see this. // Make use of features like #uncover, #only, and others to create dynamic content #uncover(2)[But this appears later!] ] ``` -------------------------------- ### Full Presentation Source Code Source: https://github.com/polylux-typ/polylux/blob/main/book/src/getting-started/getting-started.md Provides the complete source code for the slides developed in the tutorial section, including the Polylux import and the quiz dynamic content example. This serves as a reference for the entire presentation structure. ```typ {{#include ../IMPORT.typ}} {{#include quiz.typ:3:27}} ``` -------------------------------- ### Implement Dynamic Content (Quiz Example) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/getting-started/getting-started.md Showcases the use of dynamic content or overlays in Polylux by creating a quiz example. This results in multiple slides being generated from a single declaration, illustrating content that appears or changes over time. ```typ {{#include quiz.typ:20:27}} ``` -------------------------------- ### Create a Basic Slide Source: https://github.com/polylux-typ/polylux/blob/main/book/src/getting-started/getting-started.md Demonstrates the creation of a fundamental slide using the `slide` function from the Polylux package. This requires Polylux to be imported prior to its use. ```typ // Remember to actually import Polylux before this! {{#include hello-world.typ:6:8}} ``` -------------------------------- ### Import Polylux Package Source: https://github.com/polylux-typ/polylux/blob/main/book/src/getting-started/getting-started.md This snippet shows how to include the Polylux package at the beginning of your Typst document. Ensure the Polylux package is installed in your Typst environment. ```typ {{#include ../IMPORT.typ}} ``` -------------------------------- ### Complete Working Example of Polylux Presentation Source: https://context7.com/polylux-typ/polylux/llms.txt This example demonstrates the basic structure and features of a presentation created with Polylux. It includes setting up page layout, headers, footers, text styling, title slides, section markers, content slides with itemized lists and progressive disclosure, comparison slides using side-by-side layout and alternatives, and concluding slides with speaker notes. It requires the '@preview/polylux:0.4.0' package. ```typst #import "@preview/polylux:0.4.0": * // Page and text setup #set page( paper: "presentation-16-9", margin: 1.5cm, header: context [ #set text(size: 12pt) My Presentation #h(1fr) #toolbox.current-section ], footer: context [ #set text(size: 10pt) #h(1fr) #toolbox.slide-number / #toolbox.last-slide-number ] ) #set text(size: 20pt, font: "Libertinus Sans") #show heading.where(level: 1): set text(size: 1.5em, weight: "bold") #show heading.where(level: 2): set text(size: 1.2em, weight: "semibold") // Title slide #slide[ #set align(horizon + center) #text(size: 2em, weight: "bold")[ Introduction to Polylux ] #v(1em) Creating Beautiful Presentations with Typst #v(2em) Your Name \ January 2, 2026 ] // Section marker #slide[ #set align(horizon + center) #text(size: 1.8em, weight: "bold")\[Background] #toolbox.register-section("Background") ] // Content slide with progressive disclosure #slide[ == Why Polylux? #item-by-item(start: 2)[ - Write presentations in plain text - Full power of Typst typesetting - Dynamic content with overlays - Integration with presenter tools - Version control friendly ] ] // Slide with alternatives #slide[ == Comparison #toolbox.side-by-side[ *Traditional Approach* #alternatives[ - Manual formatting ][ - Manual formatting - Limited flexibility ][ - Manual formatting - Limited flexibility - Hard to version ] ][ *Polylux Approach* #alternatives[ - Code-based ][ - Code-based - Fully flexible ][ - Code-based - Fully flexible - Git-friendly ] ] ] // New section #slide[ #set align(horizon + center) #text(size: 1.8em, weight: "bold")\[Conclusion] #toolbox.register-section("Conclusion") ] // Final slide #slide[ == Thank You! Questions? #toolbox.pdfpc.speaker-note[ Be prepared for questions about: - Implementation details - Comparison with PowerPoint - Learning curve ] ] ``` -------------------------------- ### Generating the Example Image Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/simple.md This snippet shows the Typst code used to generate the example image mentioned in the documentation. It involves including necessary Polylux components and the simple theme file itself. ```typst {{#include ../../IMPORT.typ}} {{#include simple.typ:3:}} ``` -------------------------------- ### Install Polylux using Cargo Source: https://github.com/polylux-typ/polylux/blob/main/book/src/external/pdfpc.md Installs the Polylux tool from its Git repository using the Cargo package manager. This is the recommended installation method for users with Rust and Cargo installed. ```shell cargo install --git https://github.com/andreasKroepelin/polylux/ --branch release ``` -------------------------------- ### Example Code for Bipartite Theme Image (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/bipartite.md This code snippet shows how to include necessary Polylux components and a specific file (`bipartite.typ`) to generate the example image mentioned in the documentation. It's likely used for setting up the visual style of the theme. ```typst {{#include ../../IMPORT.typ}} {{#include bipartite.typ:3:}} ``` -------------------------------- ### Metropolis Theme Example Code Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/metropolis.md This snippet illustrates the inclusion of the Metropolis theme file, potentially for generating accompanying images or specific theme elements as shown in the project's example. ```typ {{#include ../../IMPORT.typ}} {{#include metropolis.typ:3:}} ``` -------------------------------- ### Control Start Subslide with #one-by-one (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/obo-lbl.md Demonstrates using the optional 'start' argument with #one-by-one to control when the revealing process begins. This allows for content to be introduced on a specific subslide rather than always from the first. ```typ #show "page" where "#one-by-one": one-by-one #one-by-one(start: 2)[ Content for subslide 1 (hidden initially). ][ Content for subslide 2 (appears first). ][ Content for subslide 3 (appears second). ] ``` -------------------------------- ### Polylux Interval Rule Example Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/complex.md Illustrates how to define display rules using intervals in Polylux, specifying a 'beginning' and/or 'until' key. This is useful for continuous ranges. ```typ #rule({ let rule = (until: 2) let rule2 = (beginning: 6, until: 8) let rule3 = (beginning: 10) rule = (rule, rule2, rule3) }) #show "polylux": set text(fill: blue) #show "polylux": rule.with(fill: red) Polylux ``` -------------------------------- ### Implement Alternative Content Matching with Polylux Source: https://context7.com/polylux-typ/polylux/llms.txt This example demonstrates advanced content control using Polylux's `alternatives-match`, `alternatives-fn`, and `alternatives-cases`. These tools allow for conditional display of content based on slide ranges or iteration counts, enabling complex presentation variations and dynamic content generation. ```typst #slide[ == Complex Alternative Patterns // Use dictionary to map subslide ranges to content #alternatives-match( position: bottom + left // Alignment within reserved space )[ (1, [First version]) ((beginning: 2, until: 4), [Second version for slides 2-4]) ("5-", [Final version from slide 5 onwards]) ] // Using alternatives-fn with a function #alternatives-fn( start: 1, count: 5, position: center )(idx => [ This is iteration #idx #text(size: (10pt * idx))[Growing!] ]) // Using alternatives-cases for conditional content #alternatives-cases( (1, "2-3", (beginning: 4)), position: top + right )(idx => { if idx == 0 [Case A] else if idx == 1 [Case B] else [Case C] }) ] ``` -------------------------------- ### Control Full Code Display in Reveal Code Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/reveal-code.md This example shows how to disable the default behavior of displaying the complete code block at the end of the reveal sequence using the `full: false` option. ```typ #reveal-code(lines: (2, 4), full: false)[``` first line second line third line fourth line fifth line ```] ``` -------------------------------- ### Add Slide Title Styling Source: https://github.com/polylux-typ/polylux/blob/main/book/src/getting-started/getting-started.md Integrates a title onto an existing slide by modifying specific lines of code. This example focuses on adding title elements to the content of a slide. ```typ {{#include slide-title.typ:15:18}} ``` -------------------------------- ### Smooth Transitions with alternatives in Typst Source: https://context7.com/polylux-typ/polylux/llms.txt Demonstrates the `#alternatives` function in Polylux for substituting content smoothly on slides, ensuring that space is maintained even when content changes. It can also specify a starting subslide and repeat the last option. ```typst #slide[ == Substituting Content Smoothly // Content changes but maintains space (no layout shift) #alternatives[Ann][Bob][Christopher] likes #alternatives[chocolate][strawberry][vanilla] ice cream. // Start at specific subslide with repeat-last option #alternatives(start: 2, repeat-last: true)[ First option ][ Second option ][ Third option (stays visible) ] ] ``` -------------------------------- ### Managing Multiple Scopes with `show: later` and `strand` Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/later.md This example illustrates how to handle multiple independent sequences of incremental reveals using the `strand` option with `#show: later`. This is useful when different parts of the presentation need to be revealed independently, preventing layouting conflicts. ```typ #[ this is scope 1 #show: later still scope 1 ] #[ this is scope 2 #show: later.with(strand: 2) still scope 2 ] ``` -------------------------------- ### Start a New Section with Clean Theme Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/clean.md Explains how to initiate a new section within a presentation using the `new-section-slide` function. This function creates a slide dedicated to the section's name, often used for structuring the presentation. The `#polylux-outline()` function can then be used to generate a table of contents based on these sections. ```typ #new-section-slide("Introduction") ``` -------------------------------- ### Set Presentation Page Size Source: https://github.com/polylux-typ/polylux/blob/main/book/src/getting-started/getting-started.md Configures the page dimensions for a presentation, specifically setting it to a 16:9 aspect ratio, which is common for modern displays. This ensures slides fit appropriately on screens. ```typ #set page(paper: "presentation-16-9") ``` -------------------------------- ### Import Polylux for Standalone Use (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/your-own.md This snippet shows the standard way to import the Polylux package when developing a theme for personal use. It assumes `polylux` is installed and available in the Typst environment. ```typst #import "polylux" // Your theme code here ``` -------------------------------- ### Install Polylux on Arch Linux Source: https://github.com/polylux-typ/polylux/blob/main/book/src/external/pdfpc.md Installs the `polylux2pdfpc` package from the Arch User Repository (AUR). This method is specific to Arch Linux users. ```shell yay -S polylux2pdfpc-git ``` -------------------------------- ### Polylux Array Rule Example Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/complex.md Demonstrates using an array to combine multiple display rules in Polylux. Array elements can be other rules, allowing for nested complexity. ```typ #rule({ let rule = (until: 2) let rule2 = (beginning: 6, until: 8) let rule3 = (beginning: 10) let rule4 = 4 rule = (rule, rule2, rule3, rule4) }) #show "polylux": set text(fill: blue) #show "polylux": rule.with(fill: red) Polylux ``` -------------------------------- ### University Theme Example Image Code Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/university.md Example Typst code used to generate the university theme's header image, likely including imported assets or specific theme elements. ```typ {{#include ../../IMPORT.typ}} {{#include university.typ:3:}} ``` -------------------------------- ### Use Science Slam Title Slide (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/your-own.md Demonstrates how to invoke the custom title slide function. This example shows passing a title and author to the `title-slide` function defined within the theme. ```typst @"science-slam.typ":use-title-slide { // Example of using the title slide function #title-slide(title: "Science Slam Night", author: "Your Name") } ``` -------------------------------- ### Typst Cover Mode Example Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/cover.md Demonstrates how to use the cover mode in Typst to control the visibility of content. The mode argument can be set to 'hide' (default) or a specific color. When a color is used, the covered text is displayed in that color. ```typ #let cover_mode = #{ // Cover content, making it invisible by default #uncover[This is normal content.] #uncover(mode: "red")[This is red content.] #uncover(mode: #blue)[This is blue content.] // Content that is hidden until revealed #show: uncover // #uncover[This content is hidden.] } ``` -------------------------------- ### Handout Mode Example in Typst Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/handout.md Illustrates the effect of handout mode on dynamic content. The provided Typst code snippet, when rendered with handout mode enabled, will display elements in a way that is suitable for static handouts, unlike its dynamic counterpart. ```typst {{#include handout.typ:5:14}} ``` -------------------------------- ### Custom Slide Layouts in Simple Theme Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/simple.md These code examples showcase custom slide layouts provided by the simple theme. Each function serves a specific purpose for content presentation, such as centering content, creating title slides, standard slides with headers/footers, or focus slides with enlarged text. ```typst #centered-slide[ ... content ... ] ``` ```typst #title-slide[ ... content ... ] ``` ```typst #slide[ ... content ... ] ``` ```typst #focus-slide(foreground: white, background: aqua.darken(50%))[ ... content ... ] ``` -------------------------------- ### Basic Incremental Reveal with `uncover` Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/later.md This code snippet demonstrates the basic concept of revealing content incrementally using the `uncover` function with manually specified indices. It serves as a foundational example before introducing the `later` function. ```typ #uncover("1-")[first] #uncover("2-")[second] #uncover("3-")[third] ``` -------------------------------- ### Sequential Reveal with one-by-one in Typst Source: https://context7.com/polylux-typ/polylux/llms.txt Shows how to use the `#one-by-one` function in Polylux to reveal content pieces sequentially. This function can start revealing from a specific subslide and allows customization of the reveal mode, such as using gray for unrevealed content. ```typst #slide[ == Revealing Content Sequentially // Reveal content pieces one at a time, starting from subslide 1 #one-by-one[First ][then second ][then third] // Start revealing from subslide 3 #one-by-one(start: 3)[piece ][by ][piece] // Use different cover mode (color instead of hide) #one-by-one(start: 2, mode: gray)[ Grayed out until revealed ][ Then this appears ] ] ``` -------------------------------- ### Integrate PDFPC for Presenter View with Polylux Source: https://context7.com/polylux-typ/polylux/llms.txt This code configures PDFPC settings and demonstrates features for presenter view. It includes setting presentation duration, start time, note font size, and default transitions. Speaker notes can be added using `speaker-note`, and slides can be hidden or marked using `hidden-slide`, `end-slide`, and `save-slide`. ```typst #import "@preview/polylux:0.4.0": * // Configure pdfpc settings at document start #toolbox.pdfpc.config( duration-minutes: 30, start-time: datetime(hour: 14, minute: 30), last-minutes: 5, note-font-size: 12, disable-markdown: false, default-transition: ( type: "push", duration-seconds: 1, angle: ltr, alignment: "horizontal", direction: "outward" ) ) #slide[ == Slide with Speaker Notes This is what the audience sees. // Add speaker notes (visible only in pdfpc presenter view) #toolbox.pdfpc.speaker-note[ Remember to mention the key points: - First important detail - Second important detail - Don't forget the demo! ] // Can also use raw blocks #toolbox.pdfpc.speaker-note(``` These notes support markdown formatting when disable-markdown is false ```) ] #slide[ == Hidden Slide for Backup // Hide this slide from main presentation flow #toolbox.pdfpc.hidden-slide This slide won't appear in the main presentation but can be accessed if needed during Q&A. ] #slide[ == Slide Markers // Mark end of current slide (useful for animations) #toolbox.pdfpc.end-slide // Save slide position for quick access #toolbox.pdfpc.save-slide ] ``` -------------------------------- ### Initializing a Theme with Custom Configuration Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/themes.md Shows how to initialize a theme using its specific initialization function, often suffixed with '-theme'. This function accepts keyword arguments for global presentation settings, like the slide aspect ratio. ```typ #show: simple-theme.with(aspect-ratio: "16-9") ``` -------------------------------- ### Set Presentation Text Size Source: https://github.com/polylux-typ/polylux/blob/main/book/src/getting-started/getting-started.md Sets the default font size for the presentation text to 25pt, ensuring readability from a distance. This is a global setting applied to all text unless overridden. ```typ #set text(size: 25pt) ``` -------------------------------- ### Importing and Using the Simple Theme Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/simple.md This code demonstrates how to import and apply the simple theme in a Typst presentation. It includes importing necessary Polylux components and the specific simple theme, then configuring the presentation to use the theme with optional arguments. ```typst #import themes.simple: * #show: simple-theme.with( aspect-ratio: "16-9", footer: [A simple footer text], background: white, foreground: black ) ``` -------------------------------- ### Apply Title Slide Styling Source: https://github.com/polylux-typ/polylux/blob/main/book/src/getting-started/getting-started.md Modifies the page and text settings to create a title slide, including choosing a specific font and color. This snippet updates the global page and text configurations. ```typ {{#include title-slide.typ:3:18}} ``` -------------------------------- ### Use Science Slam Theme Initialization (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/your-own.md Shows how to apply the custom 'science-slam' theme to a document. This involves calling the `science-slam-theme` function with desired configuration options. ```typst @"science-slam.typ":use-init { // Applying the science slam theme with a specific aspect ratio and background color #science-slam-theme(aspect: 16.0.to(9.0), bg: "#1a1a1a") // Content of the presentation goes here // For example: // ..slide["Hello World"] } ``` -------------------------------- ### Import and Use Clean Theme Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/clean.md Demonstrates how to import and apply the Clean theme to a Polylux presentation. It includes necessary imports and the theme initialization call. Requires the Polylux framework. ```typ #import themes.clean: * #show: clean-theme.with( aspect-ratio: "16-9", footer: ["My Custom Footer"], short-title: "Clean Theme Demo", logo: image("path/to/logo.png"), color: blue ) ``` -------------------------------- ### Create Basic Slides in Typst Source: https://context7.com/polylux-typ/polylux/llms.txt Demonstrates how to set up presentation dimensions and create basic slides using the `#slide` function in Polylux. It includes setting page properties and text styles before defining slide content. ```typst #import "@preview/polylux:0.4.0": * // Set up presentation dimensions and styling #set page(paper: "presentation-16-9") #set text(size: 25pt, font: "Lato") // Create a simple slide #slide[ #set align(horizon) = Welcome to My Presentation John Doe January 2, 2026 ] #slide[ == Introduction This is the content of the slide. You can use any Typst markup here. ] ``` -------------------------------- ### Basic Content Substitution with `#alternatives` Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/alternatives.md Demonstrates how to use the `#alternatives` function to display different content on subslides while ensuring that the overall structure remains stable by reserving space for the widest element. This avoids visual disruption caused by varying element widths. ```typst {{#include alternatives.typ:6:11}} ``` -------------------------------- ### Initialize Science Slam Theme (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/your-own.md Defines the main initialization function for the 'science-slam' theme. It accepts configuration options like aspect ratio and background color, and sets global text properties (size, color, font). ```typst @"science-slam.typ":init { // Science slam theme initialization function // Takes keyword arguments for configuration and content for the rest of the document. #let science-slam-theme(aspect: 16.0.to(9.0), bg: "#222", ..args) = { // Set page parameters based on aspect ratio page(aspect, fill: bg) // Define text properties for slides ..textTheme.with(size: 48pt, fill: "#eee", font: "sans-serif") // Process the rest of the document content // This is a placeholder for the actual content processing logic. // In a real theme, this would likely involve calling other theme functions or Typst's built-in elements. // For demonstration, we'll just return the content as is. ..args } } ``` -------------------------------- ### Import and Use Bipartite Theme (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/bipartite.md This code snippet demonstrates how to import the necessary Polylux components and apply the Bipartite theme to a presentation. It shows the standard way to include shared imports and then activate the theme using `bipartite-theme.with(...)`. ```typst {{#include ../../IMPORT.typ}} #import themes.bipartite: * #show: bipartite-theme.with(...) ``` -------------------------------- ### Metropolis Outline Function Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/metropolis.md Provides an example of using `#metropolis-outline` to display a table of contents based on defined sections. This is a customized version of Polylux's `#outline()`. ```typ #metropolis-outline ``` -------------------------------- ### Bipartite Theme Initialization Options (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/bipartite.md Shows how to initialize the Bipartite theme with specific aspect ratio options. The `aspect-ratio` argument can be set to '16-9' (default) or '4-3' to control the slide dimensions. ```typst bipartite-theme.with(aspect-ratio: "16-9") bipartite-theme.with(aspect-ratio: "4-3") ``` -------------------------------- ### Progressively Revealing Code with reveal-code in Typst Source: https://context7.com/polylux-typ/polylux/llms.txt Demonstrates the `#reveal-code` function in Polylux for progressively revealing lines of code within a slide. It allows specifying which lines to reveal, the starting subslide, and the appearance of unrevealed lines. ```typst #slide[ == Progressively Revealing Code #reveal-code(lines: (1, 3, 5))[```python def calculate_sum(a, b): result = a + b print(f"The sum is: {result}") return result total = calculate_sum(5, 3) ```] // Customize appearance of unrevealed lines #reveal-code( start: 2, lines: (2, 4), before: gray, // Color for lines before current after: hide, // Hide lines after current full: true // Show full code at end )[```javascript function greet(name) { const message = `Hello, ${name}`; console.log(message); return message; } ```] ] ``` -------------------------------- ### Import Polylux Logic and Utils for Packaged Themes (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/your-own.md This demonstrates the import mechanism for a theme intended to be part of the Polylux package. It avoids circular imports by referencing `logic.typ` and `utils/utils.typ` directly and then imports the theme itself into `themes/themes.typ`. ```typst #import "../logic.typ" #import "../utils/utils.typ" // Your theme code here ``` -------------------------------- ### University Theme Initialization Options Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/university.md Configuration options for the `university-theme`. These arguments control the appearance and behavior of the theme, such as aspect ratio, text elements, and color schemes. ```typ university-theme.with( aspect-ratio: "16-9", // or "4-3" short-title: "Presentation Title", short-author: "Author Name", short-date: "2023-10-27", color-a: rgb("#0C6291"), color-b: rgb("#A63446"), color-c: rgb("#FBFEF9"), progress-bar: true ) ``` -------------------------------- ### Progressively Reveal List Items with item-by-item in Typst Source: https://context7.com/polylux-typ/polylux/llms.txt Explains the `#item-by-item` function in Polylux for progressively revealing list items. It works with unordered lists, ordered lists, and term lists, allowing control over the starting subslide for the reveal. ```typst #slide[ == Revealing Lists Progressively #item-by-item(start: 2)[ - First bullet point appears on subslide 2 - Second bullet point on subslide 3 - Third bullet point on subslide 4 ] // Works with enumerations too #item-by-item[ + First numbered item + Second numbered item + Third numbered item ] // And term lists #item-by-item[ / Term 1: Definition appears first / Term 2: Definition appears second ] ] ``` -------------------------------- ### Content Matching with `#alternatives-match` Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/alternatives.md Presents the `#alternatives-match` function, which takes a dictionary mapping subslides to specific content. This is useful for situations where content needs to be explicitly defined for distinct subslide sets, requiring the user to ensure disjoint sets. ```typst {{#include alternatives-match.typ:6:9}} ``` -------------------------------- ### Open presentation with pdfpc Source: https://github.com/polylux-typ/polylux/blob/main/book/src/external/pdfpc.md Opens a compiled presentation PDF using the `pdfpc` viewer. pdfpc automatically detects and loads the corresponding `.pdfpc` file if it exists in the same directory. ```shell pdfpc thesis/talk.pdf ``` -------------------------------- ### Reveal Content Incrementally with #one-by-one (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/obo-lbl.md The #one-by-one function reveals arbitrary content elements one by one. It takes content blocks as arguments, with each block appearing on a new subslide. An optional 'start' argument can be used to begin revealing from a later subslide. ```typ #show "page" where "#one-by-one": one-by-one #one-by-one[ Content for subslide 1. ][ Content for subslide 2. ][ Content for subslide 3. ] ``` -------------------------------- ### Using Theme-Provided Slide Functions Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/themes.md Illustrates the conventional way to create slides using functions provided by a theme, such as '#title-slide' for the title slide and '#slide' for regular content slides. These replace the standard '#polylux-slide' function. ```typ #title-slide["My Presentation Title"] #slide["This is the content of a regular slide."] ``` -------------------------------- ### Configure pdfpc Global Settings in Typst Source: https://github.com/polylux-typ/polylux/blob/main/book/src/external/pdfpc.md Applies global configuration settings for pdfpc before any slides are processed. Supports setting presentation duration, start/end times, warning timers, note font size, Markdown rendering, and default transitions. ```typst #toolbox.pdfpc.config( duration-minutes: 45, start-time: datetime(hour: 14, minute: 0), last-minutes: 5, note-font-size: 12, disable-markdown: false, default-transition: (type: "fade", duration-seconds: 0.5) ) ``` -------------------------------- ### Importing a Polylux Theme Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/themes.md Demonstrates how to import a theme, such as the 'simple' theme, into your Typst project. This typically involves adding a theme-specific import alongside the main Polylux import. ```typ #import main_package.typ: * #import themes.simple: * ``` -------------------------------- ### Use Regular Slide in Science Slam Theme (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/your-own.md Illustrates how to use the `slide` function for regular presentation content. Any content passed to this function will be rendered as a standard slide. ```typst @"science-slam.typ":use-slide { // Example of using the regular slide function with some text content. #slide[This is the main content of a regular slide.] // You can include multiple elements inside a slide: #slide[ This slide has a heading: = My Subtopic And a list: - Item 1 - Item 2 ] } ``` -------------------------------- ### Display Progress Indicators and Slide Numbers with Polylux Source: https://context7.com/polylux-typ/polylux/llms.txt This code configures the page footer to display slide numbers and a progress bar using Polylux. It shows how to get the current slide number, the total number of slides, and calculate the progress ratio to visually represent presentation progress. ```typst #set page( paper: "presentation-16-9", footer: context [ // Display current slide number #toolbox.slide-number / #toolbox.last-slide-number // Display progress bar based on ratio #toolbox.progress-ratio(ratio => { let width = 100% * ratio box(width: width, height: 3pt, fill: blue) }) ] ) #slide[ == Slide with Progress Information Progress through presentation: #toolbox.progress-ratio(ratio => { text(size: 2em)[#calc.round(ratio * 100)%] }) ] ``` -------------------------------- ### Complex Scaling with #toolbox.big and Adjustments (Typst) Source: https://github.com/polylux-typ/polylux/blob/main/book/src/toolbox/big.md Demonstrates a more complex use of #toolbox.big for scaling content multiple times, with successive adjustments using linebreaks and fractional leading height. This allows for finer control over the presentation of scaled elements. ```typst #let big = toolbox.big big(box(width: 100%, height: 1fr, "First scaling.")) box(height: 1fr) big(box(width: 100%, height: 1fr, "Second scaling.")) box(height: 1fr) big(box(width: 100%, height: 1fr, "Third scaling.")) ``` -------------------------------- ### Function-Based Content with `#alternatives-fn` Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/alternatives.md Explains the `#alternatives-fn` function, which accepts a function to dynamically generate content based on the current subslide index. It requires either a `count` or `end` parameter to determine how long the content should be displayed. ```typst {{#include alternatives-fn.typ:6:9}} ``` -------------------------------- ### Utilize Layout Tools: Side-by-Side, Scaling, and Full Width with Polylux Source: https://context7.com/polylux-typ/polylux/llms.txt This snippet showcases Polylux's layout utilities for arranging content. It demonstrates creating side-by-side columns with adjustable widths and gutters, scaling content to fill available space using `big`, and extending content to the full page width with `full-width-block`. ```typst #slide[ == Side-by-Side Content #toolbox.side-by-side( columns: (1fr, 2fr), // Custom column widths gutter: 2em // Space between columns )[ Left column content. This takes 1/3 of space. ][ Right column content. This takes 2/3 of space. ] // Equal columns (default) #toolbox.side-by-side[ First column ][ Second column ][ Third column ] ] #slide[ == Scaling Content to Fill Space Some regular content above. // Scale content to fill remaining vertical space #toolbox.big[ Huge Text! ] ] #slide[ == Full Width Block Regular content respects margins. // Extend content to full page width, ignoring margins #toolbox.full-width-block(fill: blue.lighten(80%))[ #align(center)[ This content spans the entire page width ] ] ] ``` -------------------------------- ### Case-Based Content with `#alternatives-cases` Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/alternatives.md Demonstrates the `#alternatives-cases` function for scenarios where content changes slightly based on a 'case'. It allows defining a mapping from cases to content, reducing duplication compared to manually specifying content for each case. ```typst {{#include alternatives-cases.typ:18:21}} ``` -------------------------------- ### Positioning Content with `#alternatives` Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/alternatives.md Illustrates the use of the optional `position` argument with the `#alternatives` function. This allows for fine-grained control over the alignment of substituted content, improving visual presentation, especially for elements like mathematical expressions. ```typst {{#include alternatives-position.typ:6:9}} ``` -------------------------------- ### Repeating Last Content with `#alternatives` Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/alternatives.md Shows how to use the `repeat-last` parameter with the `#alternatives` function. This ensures that the last content displayed by `#alternatives` continues to be shown even after its designated subslides have passed, useful for dynamic content that should persist. ```typst {{#include alternatives-repeat-last.typ:6:8}} ``` -------------------------------- ### Create a Standard Slide with Clean Theme Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/clean.md Shows how to create a standard slide using the `slide` function from the Clean theme. The slide content is provided as the body of the function. A title for the slide can be passed as a keyword argument, which will appear in the header along with the presentation's short title and logo. ```typ #slide(title: "My Slide Title")[ // Your slide content goes here. Represents a typical slide with header and footer. ] ``` -------------------------------- ### Reveal Content Sequentially with #pause Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/pause.md This code snippet shows the equivalent of the manual #uncover() method using the #pause command in Polylux. #pause distributes content onto subsequent subslides automatically, simplifying the process. ```typst #pause #uncover("1-")[first] #uncover("2-")[second] #uncover("3-")[third] ``` -------------------------------- ### Compile Typst presentation Source: https://github.com/polylux-typ/polylux/blob/main/book/src/external/pdfpc.md Compiles a Typst presentation file (`.typ`) into a PDF using the `typst compile` command. The `--root` flag specifies the base directory for resolving relative paths. ```shell typst compile --root .. thesis/talk.typ ``` -------------------------------- ### Import and Apply Metropolis Theme Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/metropolis.md This snippet shows how to import and apply the Metropolis theme in a Polylux presentation. It includes necessary import statements and the theme application call. ```typ {{#include ../../IMPORT.typ}} #import themes.metropolis: * #show: metropolis-theme.with(...) ``` -------------------------------- ### Typst Syntax for #only and #uncover Functions Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/syntax.md Demonstrates the general syntax for using the #only and #uncover functions in Typst. These functions accept a description of subslides and the content to be shown. Typst offers syntactic sugar by allowing the content block to be placed after the function call. ```typ {{#include only-uncover.typ:5:}} ``` -------------------------------- ### Import and Use University Theme Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/university.md This snippet demonstrates how to import and apply the University theme to your Typst presentation. It includes importing necessary components and applying the theme with optional configurations. ```typ #{{#include ../../IMPORT.typ}} #import themes.university: * #show: university-theme.with(...) ``` -------------------------------- ### Define a Polylux Theme with Parameters Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes.md Demonstrates how to add parameters to a Polylux theme function. Parameters allow for customization of the theme's behavior or appearance when applied to slides. ```Typst #let dumb-theme(parameter) = data => { ( "variant 1": ..., "variant 2": ..., ) } ``` -------------------------------- ### Bookmark Slide with pdfpc in Typst Source: https://github.com/polylux-typ/polylux/blob/main/book/src/external/pdfpc.md Creates a bookmark for a specific slide in pdfpc, allowing users to jump to it later using a keyboard shortcut (Shift + M). This is useful for quickly accessing important slides. ```typst #toolbox.pdfpc.save-slide ``` -------------------------------- ### Configurable Side by Side Layout in Typst Source: https://github.com/polylux-typ/polylux/blob/main/book/src/toolbox/side-by-side.md Illustrates how to customize the layout created by #side-by-side using the 'columns' and 'gutter' optional arguments. These arguments are passed directly to Typst's #grid function, allowing for precise control over element spacing and width distribution. ```typst {{#include side-by-side-kwargs.typ:6:12}} ``` -------------------------------- ### Calculate and Display Presentation Progress Ratio with Polylux Source: https://github.com/polylux-typ/polylux/blob/main/book/src/toolbox/progress.md Shows how to use the `toolbox.progress` function to calculate the ratio of the current slide to the total number of slides. This function accepts a callback to transform the ratio into displayable content, such as a progress bar. ```typst @"progress.typ:6:24" ``` -------------------------------- ### Reveal Code Snippet with Default Settings Source: https://github.com/polylux-typ/polylux/blob/main/book/src/dynamic/reveal-code.md This snippet demonstrates the default usage of the `#reveal-code` function in Typst. It reveals code lines progressively, with previously revealed lines shown in gray and future lines hidden. The full code is displayed at the end by default. ```typ #include reveal-code.typ:6:16 ``` -------------------------------- ### Create a Standard Slide Source: https://github.com/polylux-typ/polylux/blob/main/book/src/themes/gallery/university.md Function to create a standard slide with a header and footer. The header includes a progress bar (optional), slide title, and section. The footer displays short forms of title, author, date, and slide number. Custom headers and footers can be provided. ```typ #slide(title: "Slide Title", new-section: "Introduction")[ // Slide content here ] #slide(header: [...], footer: [...])[ // Slide content with custom header/footer ] ```