Skip to content

Typst: theorem-appearance simple sets definitions, examples and exercises in italics (ignores theorem style) #15168

Closed

Description

@matthiasbaitsch

Bug description

In Typst output, the default theorem appearance (theorem-appearance: simple) sets the body of every theorem-like environment in italics, including definitions, examples and exercises.

Quarto itself classifies these environments by style in theorem_types (e.g. exr = { env = "exercise", style = "definition", ... }, likewise def and exm), and the LaTeX output honours this via amsthm: definition-style environments are upright there. The Typst renderer ignores style; simple-theorem-render always wraps the body in emph(body):

// Simple theorem render: bold title with period, italic body
#let simple-theorem-render(prefix: none, title: "", full-title: auto, body) = {
  if full-title != "" and full-title != auto and full-title != none {
    strong[#full-title.]
    h(0.5em)
  }
  emph(body)
  parbreak()
}

So the same document gives an upright exercise in PDF (LaTeX) and an italic one in Typst. Everything inside the environment is affected, e.g. tables in an exercise end up italic as well.

Steps to reproduce

---
title: Test
format:
  typst: default
  pdf: default
---

::: {#exr-a}
## Mean

Compute the mean of the following data.

| x | y |
|---|---|
| 1 | 2 |
:::

::: {#def-b}
A definition.
:::

Actual behavior

Typst: the bodies of the exercise (including the table) and of the definition are italic.

Expected behavior

Typst should follow the theorem style as the LaTeX output does: italic body for plain style (theorem, lemma, corollary, proposition, conjecture), upright body for definition (definition, example, exercise) and remark style.

A minimal approach would be to emit a second render function (or pass the style) for non-plain environments in ensure_typst_theorems, rendering body instead of emph(body).

Your environment

  • Quarto 1.10.19
  • macOS

Quarto check output

n/a – the behaviour is visible directly in src/resources/filters (ensure_typst_theorems).

Activity

  1. mcanouil commented on Oct 23, 2026

    @mcanouil
    Collaborator

    Thanks for the clear report, I can reproduce it on main.

    This is a follow-up to #14312, which was merged a few days ago. That PR moved the Typst theorem setup into modules/theorems.lua and gave ensure_simple_render a simple_style parameter, so proof, remark and solution now get an italic header and an upright body in the simple appearance. Theorems weren't part of that change: ensure_typst_theorems still passes simple_style = "theorem" for every type, so def, exm and exr keep the emph(body) they already had in 1.10.

    • local function ensure_typst_theorems(reftype)
      local appearance = _quarto.modules.theorems.ensure_appearance_imports()
      local theorem_type = theorem_types[reftype]
      local title = titleString(reftype, theorem_type.title)
      local color_scheme = "secondary"
      if theorem_type.style == "definition" then
      color_scheme = "primary"
      elseif reftype == "prp" then
      color_scheme = "tertiary"
      end
      local render_code = _quarto.modules.theorems.render_code(appearance, {
      color_scheme = color_scheme,
      color = theme_colors[reftype] or "gray",
      simple_render = "simple-theorem-render",
      simple_style = "theorem",
      })
      _quarto.modules.theorems.ensure_frame(theorem_type.env, title, render_code, true)
      end
    • -- Defines a simple renderer once. The "theorem" style writes a bold header and
      -- an italic body; the "proof" style writes an italic header and an upright
      -- body, with the name in brackets, as amsthm and the HTML output do.
      local function ensure_simple_render(render_name, style)
      if typst_simple_renderers[render_name] then
      return
      end
      typst_simple_renderers[render_name] = true
      if style == "proof" then
      quarto.doc.include_text("in-header", "#let " .. render_name .. [[(prefix: none, title: "", full-title: auto, body) = {
      emph(prefix)
      if title != "" and title != none [ (#title)]
      [. ]
      body
      parbreak()
      }
      ]])
      return
      end
      quarto.doc.include_text("in-header", "#let " .. render_name .. [[(prefix: none, title: "", full-title: auto, body) = {
      if full-title != "" and full-title != auto and full-title != none {
      strong[#full-title.]
      h(0.5em)
      }
      emph(body)
      parbreak()
      }
      ]])
      end

    The fix could build on that parameter. ensure_typst_theorems could pass the style from theorem_types, and ensure_simple_render could get a definition branch with a bold title and an upright body, as amsthm does. Each style would also need its own renderer name, because all theorem frames currently share simple-theorem-render. The proof branch can't be reused as it is, since its header is italic.

  2. self-assigned this
    on Oct 23, 2026
  3. added this to the v1.12 milestone on Oct 30, 2026
  4. added a commit that references this issue on Nov 3, 2026
    4966db7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions