Skip to content

Insertion point of include-in-header #13991

@matthiasbaitsch

Description

@matthiasbaitsch

I have:

  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide

Bug description

Code provided to include-in-header is not inserted at the end of the header.

Steps to reproduce

---
format:
    pdf:
        keep-tex: true
        include-in-header: 
            - text: |
                \usepackage{tcolorbox}
                \usepackage{keytheorems}
                \tcbset{definition_style/.style={}}
                \renewkeytheorem{definition}[style=definition,tcolorbox={definition_style}]
---

::: {#def-prime-number}
## Prime number
A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers.
:::

Actual behavior

Latex code fails to compile because \renewkeytheorem precedes \newtheorem{definition}{Definition}[section] inserted by quarto.

Expected behavior

Generates PDF document. The attached tex file works since the code in question has been moved to the end of the preamble.

demo-2-edited.tex.zip

Your environment

  • OS: macOS Tahoe 26.2

Quarto check output

Quarto 1.8.27
[✓] Checking environment information...
      Quarto cache location: /Users/maba/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.6.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.3.1: OK
      Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.8.27
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /Library/TeX/texbin
      Version: 2025

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
      Source: MacOS known location

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.12.11
      Path: /Users/maba/usr/python/global-venv/bin/python3
      Jupyter: 5.7.2
      Kernels: python3, julia-1.11, julia-1.10

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.5.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/maba/Library/R/arm64/4.5/library
        - /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
      knitr: 1.50
      rmarkdown: 2.30

[✓] Checking Knitr engine render......OK

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglatexLaTeX engines related libraries and technologies

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions